You need to sign in to do that
Don't have an account?
kentyler
assert equals not working
I have this code in a test
ClientMenuController cmc = new ClientMenuController();
cmc.client_list = Factory.CreateClientList(10);
cmc.name_search_string = '8';
Test.startTest();
PageReference r = cmc.search_name();
Integer expected = 1;
Integer actual = cmc.records_found;
Test.stopTest();
System.assertEquals( expected, actual);
the test fails
if i excute the same code outside of a test and system.debug(actual) it comes out to be 1
why is 1 not equal to 1
thanks
ken tyler
what does the error say? what is the actual value?
What are your other methods doing....
Hi
Try this
ClientMenuController cmc = new ClientMenuController();
cmc.client_list = Factory.CreateClientList(10);
cmc.name_search_string = '8';
Test.startTest();
PageReference r = cmc.search_name();
Integer expected = 1;
Integer actual = cmc.records_found;
System.assertEquals( expected, actual);
Test.stopTest();
DId this post answers your problem..If so please mark it solved .
thanks
asish