+ Start a Discussion
arun kumar 577arun kumar 577 

hi guys, i need urgent test class for this. immeadiately

public class ViewDocument{   
    public  customer__c cust{get;set;}    
    public string recId{get;set;}

    public ViewDocument(ApexPages.StandardController ctrl){
         cust=[SELECT id, Viewed_Status__c, Viewed_On__c FROM customer__cWHERE Id=:recId];
    public pageReference countClicks(){
       pagereference pr=new pagereference('/'+cust.Id);
        return pr;

public class Test_ViewDocument {
    static void ViewDocument_unitTest(){
        // Creating "customer__c" dummy data
        customer__c cust = new customer__c(Viewed_Status__c = 'test',Viewed_On__c = System.Today());
        insert cust;
        ApexPages.StandardController con = new ApexPages.StandardController(cust);
        ViewDocument vDoc = new ViewDocument(con);

Give any value for "Viewed_Status__c" if it is restricted picklist. Also, create data of any required field of "customer__c" object.

Please mark the answer as best answer if the information is informative. So that question is removed from an unanswered question and appear as a proper solution.