Checkers perform automatic dynamic verifications. There are two kinds of of checkers: class checkers and method checkers. Class checkers extend ClassChecker
and are run a class. They usually perform verifications on specific methods in a class, such as toString
. Method checkers extend MethodChecker
and are run on each method.
The IEasycoverageChecker
interface has two methods, check
and shouldCheck
. check
performs the verification, while shouldCheck
returns true if the checker is applicable on the current class or method. shouldCheck
is used to avoid unnecessary calls to check
.
BijectiveCompareToChecker
Comparable
, o1.compareTo(o2)
is always -o2.compareTo(o1)
.BijectiveEqualsChecker
equals
, o1.equals(o2)
returns the same result as o2.equals(o1)
.CloneChecker
Cloneable
, that o.equals(o.clone)
.NPEConstructorChecker
NullValueEqualsChecker
o.equals(null)
always return false.ToStringNotNullChecker
toString
does not return null
, for each class that implements it.ArrayIndexOutOfBoundExceptionChecker
GetterNotNullChecker
NPEMethodChecker
SetterChecker
To write a checker, you need to extend ClassChecker
or MethodChecker
, depending on the kind of checker you want to create. These are abstract classes, so you need to implement check
. This method should throw an EasycoverageAssertionFailedError
if the check fails. Class checkers (respectively method checkers) also need to implement shouldCheckClass
(respectively shouldCheckMethod
).