Posts

Showing posts with the label System assertEquals Salesforce

System assertEquals Salesforce

System assertEquals Salesforce, Here I am posting about assert methods in System class. This helps everyone to find the differences between assert methods in salesforce. Below are the three assert methods in system class. 1. System.assert(condition, msg) 2. System.assertEquals(expected, actual, msg) 3. System.assertNotEquals(expected, actual, msg) What is System.assert(condition, msg)? This method asserts that the specified condition is true. If it is not true, a fatal error is returned that causes code execution to halt. Signature of this method: Public static void assert(Boolean condition, Object msg) This method is having two parameters, one is  condition  which is Boolean type, the other one is  msg  which is optional and object type.   What is system.assertEquals(expected, actual, msg)? This asserts that the first two arguments are the same. if they are not same, a fatal error is returned that causes code execution halt. Signature of ...