Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 2.11 KB

README.md

File metadata and controls

59 lines (47 loc) · 2.11 KB

UtilsVerifier

UtilsVerifier is a pure Java library that can be used in Junit tests to verify that Utility class is properly defined.

Build Status Sonatype Nexus (Releases) codecov Sonatype Nexus (Snapshots) License

By default verification includes:

  • class having only one private constructor
  • class being final
  • class having no instance fields
  • class having no instance methods
  • class having no static mutable fields

Usage

    UtilsVerifier.forClass(ClassToTest.class).verify();

It's possible to disable one or more of the default verification checks by using set of "suppress" methods.

    UtilsVerifier.forClass(ClassToTest.class)
                 .suppressFinalClassCheck(true)
                 .suppressOnlyOneConstructorCheck(true)
                 .verify();

If the tested class constructor should throw an exception when used it's possible to specify the type of the exception.

    UtilsVerifier.forClass(ClassToTest.class)
                 .withConstructorThrowing(DesiredException.class)
                 .verify();

Download

To use library with Gradle

dependencies {
  compile 'com.github.karczews:utilsverifier:1.0.0'
}

or using Maven:

<dependency>
    <groupId>com.github.karczews</groupId>
    <artifactId>utilsverifier</artifactId>
    <version>1.0.0</version>
</dependency>