You need to sign in to do that
Don't have an account?
Rahul Gupta 176
So please help me with the test class i am unable to write
need help in test class for controller
public class AccListCon { public List<Account> listAccount { get; set; } public integer blockSize; public integer offSetVar; public integer total_size; public AccListCon() { offSetVar =0; blockSize =10; listAccount = [Select id, Name,BillingCity,Custom_Emaail__c ,OwnerId,phone from Account limit:blockSize ]; total_size=[select count() from account]; //isbtnEnable = true; } public PageReference funPagination() { listAccount = [Select id, Name,BillingCity,Custom_Emaail__c ,OwnerId,phone from Account limit:blockSize offset:offSetVar ]; return null; } public PageReference goToFirst() { funPagination(); offSetVar=0; return null; } public PageReference goToPrev() { funPagination(); if(offSetVar>0) { offSetVar=offSetVar-blockSize; } else ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'This is last page of list ')); return null; } public PageReference goToNext() { funPagination(); offSetVar=offSetVar+ blockSize; isbtnEnable = true; return null; } public PageReference goToLast() { funPagination(); if (offSetVar + blockSize < total_size) { offSetVar = total_size - math.mod(total_size, blockSize); } else ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'This is last page of list ')); return null; } } ------------------------------------------------------------------------------------------- <apex:page controller="AccListCon"> <apex:form > <apex:pageBlock > <apex:pageMessages ></apex:pageMessages> <apex:pageblockSection > <apex:pageBlockTable id="tblId" value="{!listAccount}" var="acc"> <apex:column value="{!acc.id}"/> <apex:column value="{!acc.name}"/> </apex:pageBlockTable> </apex:pageblockSection> <apex:pageblockButtons > <apex:commandButton action="{!goToFirst}" reRender="tblId" disabled="{!isbtnEnable}" value="<<"/> <apex:outputPanel id="btnPanelId"> <apex:commandButton id="btn1" action="{!goToPrev}" reRender="tblId,btnPanelId" value="<"/> <apex:commandButton action="{!goToNext}" reRender="tblId,btnPanelId,btn1" value=">"/> <apex:commandButton action="{!goToLast}" reRender="tblId,btnPanelId" value=">>"/> </apex:outputPanel> </apex:pageblockButtons> </apex:pageBlock> </apex:form> </apex:page>
So please help me with the test class i am unable to write
Please run the following test class and check you code coverage.
Thanks
Banwari