Package nl.jqno.equalsverifier.api
Interface EqualsVerifierApi<T>
-
- Type Parameters:
T
- The class under test.
- All Known Implementing Classes:
ConfiguredEqualsVerifier
,MultipleTypeEqualsVerifierApi
,SingleTypeEqualsVerifierApi
public interface EqualsVerifierApi<T>
Helps to construct anEqualsVerifier
test with a fluent API.
-
-
Field Summary
Fields Modifier and Type Field Description static String
WEBSITE_URL
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EqualsVerifierApi<T>
suppress(Warning... warnings)
Suppresses warnings given byEqualsVerifier
.EqualsVerifierApi<T>
usingGetClass()
Signals thatgetClass
is used in the implementation of theequals
method, instead of aninstanceof
check.<S> EqualsVerifierApi<T>
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.<S> EqualsVerifierApi<T>
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.<S> EqualsVerifierApi<T>
withPrefabValues(Class<S> otherType, S red, S blue)
Adds prefabricated values for instance fields of classes that EqualsVerifier cannot instantiate by itself.EqualsVerifierApi<T>
withResetCaches()
Signals that all internal caches need to be reset.
-
-
-
Field Detail
-
WEBSITE_URL
static final String WEBSITE_URL
- See Also:
- Constant Field Values
-
-
Method Detail
-
suppress
EqualsVerifierApi<T> suppress(Warning... warnings)
Suppresses warnings given byEqualsVerifier
. SeeWarning
to see what warnings can be suppressed.- Parameters:
warnings
- A list of warnings to suppress inEqualsVerifier
.- Returns:
this
, for easy method chaining.
-
withPrefabValues
<S> EqualsVerifierApi<T> withPrefabValues(Class<S> otherType, S red, S blue)
Adds prefabricated values for instance fields of classes that EqualsVerifier cannot instantiate by itself.- 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.- Throws:
NullPointerException
- If eitherotherType
,red
, orblue
is null.IllegalArgumentException
- Ifred
equalsblue
.
-
withGenericPrefabValues
<S> EqualsVerifierApi<T> 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.- 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.- Throws:
NullPointerException
- if eitherotherType
orfactory
is null.
-
withGenericPrefabValues
<S> EqualsVerifierApi<T> 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.- 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.- Throws:
NullPointerException
- if eitherotherType
orfactory
is null.
-
usingGetClass
EqualsVerifierApi<T> usingGetClass()
Signals thatgetClass
is used in the implementation of theequals
method, instead of aninstanceof
check.- Returns:
this
, for easy method chaining.- See Also:
Warning.STRICT_INHERITANCE
-
withResetCaches
EqualsVerifierApi<T> withResetCaches()
Signals that all internal caches need to be reset. This is useful when the test framework uses multiple ClassLoaders to run tests, causingClass
instances that would normally be equal, to be unequal, because their ClassLoaders don't match.- Returns:
this
, for easy method chaining.
-
-