Annotation Interface DbUnitColumnComparer
ValueComparer used to compare its values, nested inside
DbUnitVerifyTable.columnComparers().
comparer() is reflectively instantiated with its no-arg constructor. This
reaches any custom ValueComparer, and the stateless ValueComparers
constants - those whose implementation class has a no-arg constructor. It does not reach a
ValueComparers constant that is a configured instance built with constructor
arguments - the timestamp-tolerance comparers, for example
isActualWithinOneMinuteNewerOfExpectedTimestamp; naming one of those here fails
fast with an IllegalStateException pointing at a
VerifyTableDefinitionsProvider catalog as the fix, since a
configured comparer can only be expressed as a VerifyTableDefinition
constant written in Java.
The instantiated comparer is cached for the JVM's entire lifetime, keyed by class, and
reused by every later @DbUnitColumnComparer/DbUnitVerifyTable.defaultComparer()
naming the same class, rather than reflectively constructed anew for every test method - the
same once-and-reused-forever caching a VerifyTableDefinitionsProvider
catalog gets. A custom ValueComparer named here must therefore be a pure function
with no dependency on mutable external state that could legitimately differ between the
tests reusing it.
- Since:
- 3.6.0
- Author:
- Jeff Jensen
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionThe name of the column this comparer applies to.Class<? extends ValueComparer> TheValueComparerimplementation to use for this column, instantiated with its no-arg constructor.
-
Element Details
-
column
String columnThe name of the column this comparer applies to.- Returns:
- The column name.
-
comparer
Class<? extends ValueComparer> comparerTheValueComparerimplementation to use for this column, instantiated with its no-arg constructor.- Returns:
- The comparer class.
-