public class AssertEqualsAndHashCodeArguments extends Object
Object.equals(Object) and
Object.hashCode().
The following example is made for a class called Person. That class
contains three fields (see below) and a constructor accordingly.
assertEqualsAndHashCode(a -> new Person((int) a[0], (String) a[0], (String) a[0]),
new AssertEqualsAndHashCodeArguments()
.add(123, 456, true)
.add('John', 'Jane', false)
.add('Doe', 'Smith', false));
| Constructor and Description |
|---|
AssertEqualsAndHashCodeArguments() |
| Modifier and Type | Method and Description |
|---|---|
AssertEqualsAndHashCodeArguments |
add(Object original,
Object changed,
boolean expectEquality)
Adds information of one more argument to the current list of arguments.
|
protected List<Object> |
getChanged()
List of changed arguments
|
List<Object> |
getChangedArguments(int... indexToBeChanged)
Returns a list of original arguments, which is changed at the given indexes.
|
List<Object> |
getOriginal()
List of original arguments
|
boolean |
isExpectEquality(int index)
Returns true, if the argument at
index is meant to be used for
equality checks. |
public AssertEqualsAndHashCodeArguments add(@Nullable Object original, @Nullable Object changed, boolean expectEquality)
original - original valuechanged - changed valueexpectEquality - true, if argument is used for equalitypublic List<Object> getOriginal()
protected List<Object> getChanged()
public List<Object> getChangedArguments(int... indexToBeChanged)
indexToBeChanged - list of indexes to be changedindexToBeChangedpublic boolean isExpectEquality(int index)
index is meant to be used for
equality checks.index - argument indexindex is used for equalityCopyright © 2020. All rights reserved.