You need to sign in to do that
Don't have an account?
Ken Koellner
Code Coverage on custom Exception classes, is it covered when there are no executable lines?
I have a simple custom exception class. Since it's referenced from more than one class, I did not make it an inner class. It is in a class all by itself that reads as below--
public class OppSyncException extends Exception { }
I have Apex tests that instantiate this exception. But when I look at the code coverate for that module it says 0%. Now it has 0 executable lines so technically coverage is undfined (0/0).
What I want to know is will I have a problem trying to deploy this module where it will complain that the coverage is < 75%?
Yes, you will not be able to deploy it. Just create a unit test that creates an instance of the class.
I have a test class that instantiates the custom exception class.
I still get 0% coverage.
What happens when you try to deploy it?
Haven't tried yet. We have a BIG org, just running our tests takes two hours. And, I have to get a whole package ready.
It really doesn't matter if the coverage for that class is 0 or 100. It's not affecting your org's coverage % either way. It adds nothing to the numerator or the denominator.