Timeline for Apex test code - system assert error
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 3, 2014 at 17:43 | vote | accept | Shawn | ||
Oct 3, 2014 at 17:37 | comment | added | greenstork | It should look like this, sorry I wasn't more clear: System.assertEquals (null,c1.Roles__c); | |
Oct 3, 2014 at 17:33 | comment | added | Shawn | Did as you suggested and got this error System.AssertException: Assertion Failed: Expected: , Actual: null | |
Oct 3, 2014 at 17:19 | comment | added | greenstork | Take null out of quotes, you are looking for the string null and not the value null | |
Oct 3, 2014 at 17:15 | comment | added | Shawn | Test.startTest(); insert R; Test.stopTest(); c1 = [SELECT Id, Roles__c FROM Contact WHERE Id=:c1.Id]; System.assertEquals ('Primary Contact:',c1.Roles__c); Delete R; c1 = [SELECT Id, Roles__c FROM Contact WHERE Id=:c1.Id]; System.assertEquals ('null',c1.Roles__c); } } but got this error Error Message System.AssertException: Assertion Failed: Expected: null, Actual: null Stack Trace Class.EmptyContactRole.validateEmptyContactRole: line 19, column 1 | |
Oct 3, 2014 at 17:02 | history | answered | greenstork | CC BY-SA 3.0 |