I am testing a helper class with only static methods with JUnit4 and Cobertura. Testing methods was easy task and is done already.
However, cobertura shows that the class is not covered by tests completely, as it is not instantiated anywhere.
I don't want to create an instance of this class (it is a helper class), so first solution is to hide constructor (which is generally good approach for helper class).
Then cobertura complains that the empty private constructor is not covered by tests.
Is there any solution to achieve 100% code coverage for such situation?
Code coverage is required from top level management (in this case), so for me obtaining 100% for this particular class is quite helpful.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…