You need to sign in to do that
Don't have an account?
narendra jagwan
fully compete code coverage
how we can build the test class of this wrapper class ... my code coverage only 71% plz suggest me what code that's 100% c
public PageReference processSelected()
{
//We create a new list of Contacts that we be populated only with Contacts if they are selected
selectedEmployee = new List<Employee1_del__c>();
//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
for(eEmployee eCon: getEmployee())
{
if(eCon.selected == true)
{
selectedEmployee.add(eCon.con);
}
}
system.debug('<<<<<<<<'+selectedEmployee[0].id);
// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
System.debug('These are the selected Contacts...');
for(Employee1_del__c con: selectedEmployee)
{
system.debug('+++++++++'+con);
}
// we need this line if we performed a write operation because getContacts gets a fresh list now
employeeList=null;
PageReference pg = new PageReference('https://ap1.salesforce.com/'+selectedEmployee[0].id+'/e?retURL=%2F');
pg.setRedirect(true);
return pg;
}
public void dele()
{
list<Employee1_del__c> c=[Select id from Employee1_del__c];
delete c;
}
// delete select
public void se()
{
List<Employee1_del__c> accToDel = new List<Employee1_del__c>();
for(eEmployee wrap : employeeList)
{
/*Check if record is selected*/
if(wrap.selected)
{
accToDel.add(wrap.con);
}
}
public PageReference processSelected()
{
//We create a new list of Contacts that we be populated only with Contacts if they are selected
selectedEmployee = new List<Employee1_del__c>();
//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
for(eEmployee eCon: getEmployee())
{
if(eCon.selected == true)
{
selectedEmployee.add(eCon.con);
}
}
system.debug('<<<<<<<<'+selectedEmployee[0].id);
// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
System.debug('These are the selected Contacts...');
for(Employee1_del__c con: selectedEmployee)
{
system.debug('+++++++++'+con);
}
// we need this line if we performed a write operation because getContacts gets a fresh list now
employeeList=null;
PageReference pg = new PageReference('https://ap1.salesforce.com/'+selectedEmployee[0].id+'/e?retURL=%2F');
pg.setRedirect(true);
return pg;
}
public void dele()
{
list<Employee1_del__c> c=[Select id from Employee1_del__c];
delete c;
}
// delete select
public void se()
{
List<Employee1_del__c> accToDel = new List<Employee1_del__c>();
for(eEmployee wrap : employeeList)
{
/*Check if record is selected*/
if(wrap.selected)
{
accToDel.add(wrap.con);
}
}
can u post r test class u have written already.
@isTest
public with sharing class EmployeeTest {
static testMethod void mTest(){
list<Employee1_del__c> c=[Select id from Employee1_del__c];
List<Employee1_del__c> emp =new List<Employee1_del__c> ();
Employee1_del__c EmplDe=new Employee1_del__c();
EmplDe.Email__c='hm@gmail.com';
EmplDe.Mobile__c=96586455;
EmplDe.Name='bhatt';
// EmplDe.Company__r.name='jay';
insert EmplDe;
EmplDe.Email__c='hm@gmail.com';
EmplDe.Mobile__c=965897;
EmplDe.Name='hattt';
delete c;
emp.add(EmplDe);
c.add(EmplDe);
wrapperClassController cls = new wrapperClassController();
cls.getEmployee();
cls.showChange();
cls.getTotalPages();
cls.Previous();
cls.save();
cls.Beginning();
cls.End();
cls.getDisableNext();
cls.getDisablePrevious();
cls.getPageNumber();
cls.getTotal_size();
cls.page();
cls.processSelected();
cls.Next();
cls.del();
cls.dele();
cls.se();
}
}
when wrapper classes , we need to select the record to process
you have created two records but you didn't select the any record to process it., wrap.selected or econ.selected is equals to true.