You need to sign in to do that
Don't have an account?
SFDC_Learner
code coverage
Code coverage for this class:
public class catchtest
{
public void m1()
{
integer i=10,j=0,d;
try
{
d=i/j;
// some statements
}
catch(Exception e)
{
//some statements
}
How can i conver the code, when i have try and catch block in my class.
Thanks
Best Answer chosen by Admin (Salesforce Developers)
VVNRAO
public class catchtest
{
public Integer i{get;set;}
public Integer j{get;set;}
public void m1()
{
Integer d;
try
{
d=i/j;
system.debug('******** D ********'+d);
}
catch(Exception e)
{
String result=String.valueof(e);
system.debug('******* Exception is **'+Result);
}
}
static testmethod void testm1()
{
catchtest obj1=new catchtest();
obj1.i=20;
obj1.j=0;
obj1.m1();
obj1.i=20;
obj1.j=10;
obj1.m1();
}
}