+ Start a Discussion
ChermaduraiChermadurai 

i got 67% only how can i increase this..

Please help me to reach above 75% for the below test case..now its only 67%

 

public with sharing class storeInquiryListController {
Public Integer noOfRecords{get; set;}
Public Integer size{get;set;}
public string errormsg{get;set;}
public String status;
Public String contid;
public ApexPages.StandardSetController setCon {
get{ if(setCon == null){
status='';
contid='';
try {
status = ApexPages.currentPage().getParameters().get('status');
if(status!=null)
status = status.trim();
contid=ApexPages.currentPage().getParameters().get('Id');
if(contid!=null)
contid = contid.trim();
} catch (System.StringException e) {
System.debug('Error in param Processing: ' + e);
}
size = 25;
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';

setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size);
noOfRecords = setCon.getResultSize();
if(noOfRecords ==0) {
errormsg='No records to display';
} else {
errormsg='';
}
}
return setCon;
}set;
}
Public List<FBR_Inquiry__c> getStoreInquiryList(){
List<FBR_Inquiry__c> inqList = new List<FBR_Inquiry__c>();
List<FBR_Inquiry__c> castList =(List<FBR_Inquiry__c>)setCon.getRecords();
for(FBR_Inquiry__c a : castList ) //(List<FBR_Inquiry__c>)setCon.getRecords())

inqList.add(a);

return inqList;

}
public pageReference refresh() {
 if( size ==25)
{
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }
if( size ==50)
{
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }
if( size ==100)
{
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }
if( size ==200)
{
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }

return null;
}
public Integer getpage{
get{ integer i;
if(math.mod(noOfRecords,size)==0) {
i=noOfRecords/size;
}else {
i=noOfRecords/size+1;
}
return i;
}
set;}
//Test Case

static testmethod void testPagingstoreInquiryListController()
{

integer noOfRecords;
try{
Test.startTest();
ApexPages.StandardSetController setCon;

storeInquiryListController Si=new storeInquiryListController ();
ID contid='a0hQ0000002yfkK';
ID status='00NQ0000000ouHz';

ApexPages.currentPage().getParameters().put('id', status);
ApexPages.currentPage().getParameters().put('id', contId);

integer size=25;
try
{
String queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
Setcon.setPageSize(size);
if(noOfRecords ==0) {
system.debug('No records to display');
} else {
//errormsg='';
}

}
Catch (Exception e){}

List<FBR_Inquiry__c> inqList = new List<FBR_Inquiry__c>();
FBR_Inquiry__c ob =new FBR_Inquiry__c();
inqList.add(ob);
System.assert(inqList.size()>0);

//ApexPages.StandardSetController controller = new ApexPages.StandardSetController(inqList);
//Si.getStoreInquiryList();
Si.refresh();


if( size ==25)
{

ApexPages.currentPage().getParameters().put('id', status);
ApexPages.currentPage().getParameters().put('id', contId);
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }
if( size ==50)
{
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }
if( size ==100)
{
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }
if( size ==200)
{
string queryString = 'SELECT Id, Name,KPIInquiryContent__c,Status__c,ModifyDate__c '+
' FROM FBR_Inquiry__c WHERE KPIInquiryContent__c = \''+contid+
'\' AND Status__c = \''+status +'\' Order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); }
Si.getStoreInquiryList();
try
{
Integer i = Si.getpage;
System.assertNotEquals(Si, null);
if(math.mod(noOfRecords,size)==0) {
i=noOfRecords/size;
}else {
i=noOfRecords/size+1;
}

}
catch(Exception E){}
test.stopTest();
}
catch(Exception E){}
}
}

jd123jd123

Hey 

 

Can highlight which lines are not covered??

ChermaduraiChermadurai

Jd,

 

The colored lines are not covered..