My Business class (Custom Controller)
public with sharing class SalesTask {
public PageReference clientApproved() {
//Update the current task to close
pmt.Status__c = 'Completed';
pmt.Type_of_layout__c = 'Support';
pmt.Proposal_Status__c = 'Client Approved';
update pmt;
PageReference cancel= new PageReference(System.currentPageReference().getParameters().get('retURL'));
cancel.setRedirect(true);
return cancel;
}
public SalesTask(){
this.pmt = new PMO_Task__c();
List<PMO_Task__c> pmtList = new List<PMO_Task__c>();
pmtList = [SELECT Subject__c,AssigedDate__c,AssignedBy__c,MyComments__c,Status__c,Opportunity__c,Type_of_layout__c FROM PMO_Task__c WHERE id = :System.currentPageReference().getParameters().get('id') ];
pmt = pmtList.get(0);
}
Test Class which I have written
@isTest
public class PSalesTaskTest{
private static testmethod void SalesTaskTest() {
PageReference pg = Page.pmotrackertasks;
Test.setCurrentPage(pg);
pg.getParameters().put('Status__c', 'Completed');
pg.getParameters().put('Type_of_layout__c', 'Support');
pg.getParameters().put('Proposal_Status__c', 'Client Approved');
PMOSalesTask pmo = new PMOSalesTask();
pmo.reject();
}
}
Kindly help me to achieve code coverage i'm not able to call method from test class to i'm getting error when run the test class
System.ListException: List index out of bounds: 0