function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vajralavajrala 

what is the use of system.assert() system.assertEquals()

I am not undestanding where we use system.assert() and system.assertEquals() and how it is working

please give me explanation with an example

bvramkumarbvramkumar

You can use system.assert to evaluate any type of condition. Where as system.assertEquals enforce "Equals" condition.

vajralavajrala

What happens when the condition is fails

please give me explanation with an example

bvramkumarbvramkumar

When the conditions fails, a test failure will occur and will not execute the test code written after your system.assert() statement. The potential results of the failure of a system.assert() are Deployment failure and loss of test coverage.

praveen naraharisettypraveen naraharisetty
String myString1 = 'abcde';
String myString2 = 'abcd';
Integer result = 
   myString1.compareTo(myString2);
System.assertEquals(result, 1);
try dis xmpl