function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
R R MR R M 

Help with test class code

HI Friends, 

I am Newbie in writing Test classes, Please do help with test code for this apex class. 

public with sharing class AccountController {
    public AccountController() {
    }
    public AccountController(ApexPages.StandardController controller) {

    }
Public String selectedTab {get; set;}
    Public Integer noOfRecords{get; set;}
    Public Integer size{get;set;}
    
    User U;
    
    public ApexPages.StandardSetController setCon {
        get{
            if(setCon == null){
                size = 25;
                U = [select id,Phone,name from User WHERE ID =:userinfo.getUserId()]; 
                string queryString = 'Select Name, Rating,Phone from Account order by Name';
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT id,Name,Phone from Account Where Phone =:U.Phone AND Rating ='Hot']));
                setCon.setPageSize(size);
                noOfRecords = setCon.getResultSize();
            }
            return setCon;
        }set;
    }
    
    Public List<Account> getAccounts(){
        List<Account> accList = new List<Account>();
        for(Account a : (List<Account>)setCon.getRecords())
            accList.add(a);
        return accList;
    }
    
    public pageReference refresh() {
        setCon = null;
        getAccounts();
        setCon.setPageNumber(1);
        return null;
    }
}
 
goabhigogoabhigo
What did you write so far? I wouldn't expect the Forum to give you the entire test class. Show us what have you done.

--
Abhi