net.sf.qualitytest
Class CoverageForPrivateConstructor

java.lang.Object
  extended by net.sf.qualitytest.CoverageForPrivateConstructor

public final class CoverageForPrivateConstructor
extends Object

Code coverage often report missing line coverage if your utility classes contain private constructors. Still, it is good practice to assure that utility classes cannot be constructed. This utility class will execute a private default constructor in a class and therefore remove this noise from your code coverage reports.

Author:
Dominik Seichter

Method Summary
static void giveMeCoverage(Class<?> clazz)
          Reduce noise in code coverage reports by executing the private default constructor of a utility class.
protected static void giveMeCoverageInternal(Class<?> clazz)
          Internal method which we can mock to simulate different exceptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

giveMeCoverage

public static void giveMeCoverage(@Nonnull
                                  Class<?> clazz)
Reduce noise in code coverage reports by executing the private default constructor of a utility class.

Parameters:
clazz - The private default constructor of this class is executed.

giveMeCoverageInternal

protected static void giveMeCoverageInternal(@Nonnull
                                             Class<?> clazz)
                                      throws NoSuchMethodException,
                                             InstantiationException,
                                             IllegalAccessException,
                                             InvocationTargetException
Internal method which we can mock to simulate different exceptions.

Parameters:
clazz -
Throws:
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetException


Copyright © 2012-2013. All Rights Reserved.