You need to sign in to do that
Don't have an account?
ChellS @ India
Is it possible to write a test class for an exception for 100% coverage, as shown below.
global class customException extends Exception {}
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
You can throw the exception in a test to give you have coverage, but the test proves nothing. What you want is to test the code where you are using (throwing) this exception.
I would also suggest naming the customException to something more specific to the error you are using it for. Create individual custom exceptions for all the exceptions you are throwing. This will then allow you to the catch and identify specific exceptions you are using making it more manageble going forward.
Thanks,
Richard.