System.assertEquals

System.assertEquals(arg1,arg2) asserts if arg1 and arg2 are same, else it throws an error. It is mainly used for tracking errors.

Example1:

//Perfect System.assertEquals
try
{
    Integer i =90;
    System.assertEquals(i,90);
}
catch(Exception e)
{
}

Example2:

//Erroneous System.assertEquals
try
{
    Integer i =95;
    System.assertEquals(i,90);
}
catch(Exception e)
{
}


Cheers!!!

No comments:

Post a Comment