Class MultipleTypeEqualsVerifierApi

    • Method Detail

      • withPrefabValues

        public <S> MultipleTypeEqualsVerifierApi withPrefabValues​(Class<S> otherType,
                                                                  S red,
                                                                  S blue)
        Adds prefabricated values for instance fields of classes that EqualsVerifier cannot instantiate by itself.
        Specified by:
        withPrefabValues in interface EqualsVerifierApi<Void>
        Type Parameters:
        S - The class of the prefabricated values.
        Parameters:
        otherType - The class of the prefabricated values.
        red - An instance of S.
        blue - Another instance of S, not equal to red.
        Returns:
        this, for easy method chaining.
      • withGenericPrefabValues

        public <S> MultipleTypeEqualsVerifierApi withGenericPrefabValues​(Class<S> otherType,
                                                                         Func.Func1<?,​S> factory)
        Adds a factory to generate prefabricated values for instance fields of classes with 1 generic type parameter that EqualsVerifier cannot instantiate by itself.
        Specified by:
        withGenericPrefabValues in interface EqualsVerifierApi<Void>
        Type Parameters:
        S - The class of the prefabricated values.
        Parameters:
        otherType - The class of the prefabricated values.
        factory - A factory to generate an instance of S, given a value of its generic type parameter.
        Returns:
        this, for easy method chaining.
      • withGenericPrefabValues

        public <S> MultipleTypeEqualsVerifierApi withGenericPrefabValues​(Class<S> otherType,
                                                                         Func.Func2<?,​?,​S> factory)
        Adds a factory to generate prefabricated values for instance fields of classes with 2 generic type parameters that EqualsVerifier cannot instantiate by itself.
        Specified by:
        withGenericPrefabValues in interface EqualsVerifierApi<Void>
        Type Parameters:
        S - The class of the prefabricated values.
        Parameters:
        otherType - The class of the prefabricated values.
        factory - A factory to generate an instance of S, given a value of each of its generic type parameters.
        Returns:
        this, for easy method chaining.
      • except

        public MultipleTypeEqualsVerifierApi except​(Class<?> type,
                                                    Class<?>... more)
        Removes the given type or types from the list of types to verify.
        Parameters:
        type - A type to remove from the list of types to verify.
        more - More types to remove from the list of types to verify.
        Returns:
        this, for easy method chaining.
      • except

        public MultipleTypeEqualsVerifierApi except​(Predicate<Class<?>> exclusionPredicate)
        Removes all types matching the given Predicate.
        Parameters:
        exclusionPredicate - A Predicate matching classes to remove from the list of types to verify.
        Returns:
        this, for easy method chaining.
      • verify

        public void verify()
        Performs the verification of the contracts for equals and hashCode and throws an AssertionError if there is a problem.
        Throws:
        AssertionError - If one of the contracts is not met, or if EqualsVerifier's preconditions do not hold.