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
AshwAshw 

How to Do Code Coverage for empty class. this class in our org i dont now what is the use of this empty class

public class activate {

}

Test class:

@isTest
private class emptyclass_Test{
    static testmethod void mycodecoverage(){
    test.startTest();
        activate em = new activate();
        
        test.stopTest();
    }
}
Best Answer chosen by Ashw
ManojjenaManojjena
Hey Vinod,
If you want just code coverage then you need to add one no argument constuctor in the class .How ever empty class we can create for custom exception .
One more thing which version this class is ,as activate is reserve word in apex it should not allow you to save the class .

If it allowing then add constructor then your code will give 100 % code coverage .



 

All Answers

ManojjenaManojjena
Hey Vinod,
If you want just code coverage then you need to add one no argument constuctor in the class .How ever empty class we can create for custom exception .
One more thing which version this class is ,as activate is reserve word in apex it should not allow you to save the class .

If it allowing then add constructor then your code will give 100 % code coverage .



 
This was selected as the best answer
AshwAshw
Thanks Manoj but im trying the same thing for below class im getting this error 
[Error] Error: Compile Error: System exception constructor already defined: <Constructor>() at line 2 column 12
public class activate extends Exception {
    public activate(){
    }
}