Class SimpleComparisonResult

  • All Implemented Interfaces:
    ComparisonResult
    Direct Known Subclasses:
    MapComparisonResult

    public class SimpleComparisonResult
    extends java.lang.Object
    implements ComparisonResult
    The most basic comparison result. This is just a boolean yes/no, without any additional information.
    Author:
    Rene Schneider - initial API and implementation
    • Field Detail

      • EQUAL

        public static final SimpleComparisonResult EQUAL
        The result value for "equality". Can be used to prevent allocation of new objects.
      • NOT_EQUAL

        public static final SimpleComparisonResult NOT_EQUAL
        The result value for "inequality". Can be used to prevent allocation of new objects.
    • Constructor Detail

      • SimpleComparisonResult

        public SimpleComparisonResult​(boolean anEqualityFlag)
        Creates a new instance.
        Parameters:
        anEqualityFlag - whether the result should represent equality or inequality
    • Method Detail

      • isSuccessful

        public boolean isSuccessful()
        Description copied from interface: ComparisonResult
        Whether this result documents a successful comparison. Most of the time, this boils down to whether the result equals the expected value, but custom comparator fixtures may override this.
        Specified by:
        isSuccessful in interface ComparisonResult
        Returns:
      • equals

        public boolean equals​(java.lang.Object anOther)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object