Class EquivalenceTester<T>


  • @Beta
    @GwtCompatible
    public final class EquivalenceTester<T>
    extends Object
    Tester for Equivalence relationships between groups of objects.

    To use, create a new EquivalenceTester and add equivalence groups where each group contains objects that are supposed to be equal to each other. Objects of different groups are expected to be unequal. For example:

    
     EquivalenceTester.of(someStringEquivalence)
         .addEquivalenceGroup("hello", "h" + "ello")
         .addEquivalenceGroup("world", "wor" + "ld")
         .test();
     

    Note that testing Object.equals(Object) is more simply done using the EqualsTester. It includes an extra test against an instance of an arbitrary class without having to explicitly add another equivalence group.

    Since:
    10.0
    Author:
    Gregory Kick