+ Start a Discussion
nyhansanyhansa 

System AssertException Assertion Failed but Values Match

I am getting an error on one of the system assertEquals in my test class, however when I check the debug log the assert appears to have passed. I've included the code snippets from my controller class, test class, and the debug log.

 

Test Class Lines:

String testDebugSoqll = crc.debugSoqll;
System.assertEquals('select firstname, lastname, employer__c, state, owner.name from lead where isconverted = false order by lastname asc limit 20', testDebugSoqll);

 

Controller Lines:

//some other code here

public String sortDirl {
get { if (sortDirl == null) { sortDirl = 'asc'; } return sortDirl; }
set;
}

// the current lead field to sort by - defaults to last name
public String sortFieldl {
get { if (sortFieldl == null) { sortFieldl = 'lastName'; } return sortFieldl; }
set;
}

public String debugSoqll {

get { return soqll + ' order by ' + sortFieldl + ' ' + sortDirl + ' limit 20'; }
set;
}

public CrossReferenceController() {
soqll = 'select firstname, lastname, employer__c, state, owner.name from lead where isconverted = false';

//code continues

 

Debug Log Exception Details:

12:19:19.444 (6444732000)|EXCEPTION_THROWN|[56]|System.AssertException: Assertion Failed:

Expected: select firstname, lastname, employer__c, state, owner.name from lead where isconverted = false order by lastname asc limit 20,
Actual: select firstname, lastname, employer__c, state, owner.name from lead where isconverted = false order by lastName asc limit 20

 

I would greatly appreciate any help. I cannot figure out why the assertion is failing since from what I see, they seem to be exactly the same. Let me know if you need me to post the entire controller class, test class, and visualforce page.

 

Thank you!

 

Sam

Best Answer chosen by Admin (Salesforce Developers) 
Eric_HDCEric_HDC

The only difference I see is:

order by lastname     vs.

order by lastName

All Answers

Eric_HDCEric_HDC

The only difference I see is:

order by lastname     vs.

order by lastName

This was selected as the best answer
nyhansanyhansa

Thank you so much for the second set of eyes! I had looked at it so many times I was reading it as though they were typed the same.