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
Ken KoellnerKen 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%?

 

 

 

ptepperptepper

Yes, you will not be able to deploy it.  Just create a unit test that creates an instance of the class.

Ken KoellnerKen Koellner

I have a test class that instantiates the custom exception class.

 

I still get 0% coverage.

 


ptepper wrote:

Yes, you will not be able to deploy it.  Just create a unit test that creates an instance of the class.




ptepperptepper

What happens when you try to deploy it?

Ken KoellnerKen Koellner

ptepper wrote:

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.

 

rungerrunger

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.