Here is the Code.
public with sharing class page1
{
@TestVisible private integer totalRecs = 0;
@TestVisible private integer index = 0;
public integer blockSize = 5;
public page1(ApexPages.StandardController controller)
{
totalRecs = [select count() from Account where name!= null limit 10];
}
public List<Account> getaccounts()
{
List<Account> accs = Database.Query('SELECT name, site, Phone, Website, Fax, AccountNumber, Rating FROM Account LIMIT :blockSize OFFSET :index');
System.debug('Values are ' + accs);
return accs;
}
public void beginning()
{
index = 0;
}
public void previous()
{
index = index - blockSize;
}
public void next()
{
index = index + blockSize;
}
public void end()
{
index = totalrecs - math.mod(totalRecs,blockSize);
}
public boolean getprev()
{
if(index == 0)
return true;
else
return false;
}
public boolean getnxt()
{
if((index + blockSize) > totalRecs)
return true;
else
return false;
}
}
Not able to cover else statement in Boolean method
page1 obj = new page1(); obj.getprev();
obj.index =1
then again callobj.getprev();
it will cover the else part as well