I created a class the will return set and get the parameter to rest service here is the class
public class LeadUtils
{
public String First_nm;
public String Last_nm;
public String Phone;
public String Email_id;
public String Company;
public String getFirstName() {
return this.First_nm;
}
public void setFirstName(String First_nm) {
this.First_nm= First_nm;
}
public String getLastName() {
return this.Last_nm;
}
public void setLastName(String Last_nm) {
this.Last_nm= Last_nm;
}
public String getPhone() {
return this.Phone;
}
public void setPhone(String Phone) {
this.Phone= Phone;
}
public String getEmail() {
return this.Email_id;
}
public void setEmail(String Email_id) {
this.Email_id= Email_id;
}
public String getCompany() {
return this.Company;
}
public void setCompany(String Company) {
this.Company= Company;
}
}
And create test class for this
@isTest
public class LeadUtilsTest
{
public static testMethod void testParameter() {
// Instantiate a new controller with all parameters in the page
LeadUtils Utils= new LeadUtils();
Utils.setFirstName('lastname');
Utils.setLastName('firstname');
Utils.setPhone('[email protected]');
Utils.setEmail('[email protected]');
Utils.setCompany('acme');
// Verify that the success page displays
Lead[] leads = [select id, email from lead where Company = 'VVDN'];
//System.assertEquals('[email protected]', leads[0].email);
}
}
When i run the test it shows 60% code convergence. But I need above 75% for the deployment