Package nl.jqno.equalsverifier
Class ConfiguredEqualsVerifier
java.lang.Object
nl.jqno.equalsverifier.ConfiguredEqualsVerifier
- All Implemented Interfaces:
EqualsVerifierApi<Void>
-
Field Summary
Fields inherited from interface nl.jqno.equalsverifier.api.EqualsVerifierApi
WEBSITE_URL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a copy of the configuration.<T> SingleTypeEqualsVerifierApi<T>Factory method.forClasses(Class<?> first, Class<?> second, Class<?>... more) Factory method.forClasses(Iterable<Class<?>> classes) Factory method.forPackage(String packageName) Factory method.forPackage(String packageName, boolean scanRecursively) Factory method.Suppresses warnings given byEqualsVerifier.Signals thatgetClassis used in the implementation of theequalsmethod, instead of aninstanceofcheck.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.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.withPrefabValues(Class<S> otherType, S red, S blue) Adds prefabricated values for instance fields of classes that EqualsVerifier cannot instantiate by itself.Signals that all internal caches need to be reset.
-
Constructor Details
-
ConfiguredEqualsVerifier
public ConfiguredEqualsVerifier()Constructor.
-
-
Method Details
-
copy
Returns a copy of the configuration.- Returns:
- a copy of the configuration.
-
suppress
Suppresses warnings given byEqualsVerifier. SeeWarningto see what warnings can be suppressed.- Specified by:
suppressin interfaceEqualsVerifierApi<Void>- Parameters:
warnings- A list of warnings to suppress inEqualsVerifier.- Returns:
this, for easy method chaining.
-
withPrefabValues
Adds prefabricated values for instance fields of classes that EqualsVerifier cannot instantiate by itself.- Specified by:
withPrefabValuesin interfaceEqualsVerifierApi<Void>- Type Parameters:
S- The class of the prefabricated values.- Parameters:
otherType- The class of the prefabricated values.red- An instance ofS.blue- Another instance ofS, not equal tored.- Returns:
this, for easy method chaining.
-
withGenericPrefabValues
public <S> ConfiguredEqualsVerifier 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:
withGenericPrefabValuesin interfaceEqualsVerifierApi<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 ofS, given a value of its generic type parameter.- Returns:
this, for easy method chaining.
-
withGenericPrefabValues
public <S> ConfiguredEqualsVerifier 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:
withGenericPrefabValuesin interfaceEqualsVerifierApi<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 ofS, given a value of each of its generic type parameters.- Returns:
this, for easy method chaining.
-
usingGetClass
Signals thatgetClassis used in the implementation of theequalsmethod, instead of aninstanceofcheck.- Specified by:
usingGetClassin interfaceEqualsVerifierApi<Void>- Returns:
this, for easy method chaining.- See Also:
-
withResetCaches
Signals that all internal caches need to be reset. This is useful when the test framework uses multiple ClassLoaders to run tests, causingClassinstances that would normally be equal, to be unequal, because their ClassLoaders don't match.- Specified by:
withResetCachesin interfaceEqualsVerifierApi<Void>- Returns:
this, for easy method chaining.
-
forClass
Factory method. For general use.- Type Parameters:
T- The type.- Parameters:
type- The class for which theequalsmethod should be tested.- Returns:
- A fluent API for EqualsVerifier.
-
forClasses
Factory method. For general use.- Parameters:
classes- An iterable containing the classes for whichequalsmethod should be tested.- Returns:
- A fluent API for EqualsVerifier.
-
forClasses
Factory method. For general use.- Parameters:
first- A class for which theequalsmethod should be tested.second- Another class for which theequalsmethod should be tested.more- More classes for which theequalsmethod should be tested.- Returns:
- A fluent API for EqualsVerifier.
-
forPackage
Factory method. For general use.Note that this operation may be slow. If the test is too slow, use
forClasses(Class, Class, Class...)instead.- Parameters:
packageName- A package for which each class'sequalsshould be tested.- Returns:
- A fluent API for EqualsVerifier.
-
forPackage
Factory method. For general use.Note that this operation may be slow. If the test is too slow, use
forClasses(Class, Class, Class...)instead.- Parameters:
packageName- A package for which each class'sequalsshould be tested.scanRecursively- true to scan all sub-packages- Returns:
- A fluent API for EqualsVerifier.
-