-
-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE 2629] Add indices in containsExactly()
Introduces an IndexedDiff to keep track of the diff at an index. If the lists are of the same length and contain the same elements, but are in not in the same order, print the indices - limited to 50 - where a mismatch occurred.
- Loading branch information
Showing
6 changed files
with
207 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.assertj.core.internal; | ||
|
||
/** | ||
* The actual and expected elements at a given index. | ||
* */ | ||
public class IndexedDiff { | ||
private final Object actual; | ||
private final Object expected; | ||
private final int index; | ||
|
||
/** | ||
* Create a {@link IndexedDiff}. | ||
* @param actual the actual value of the diff. | ||
* @param expected the expected value of the diff. | ||
* @param index the index the diff occurred at. | ||
*/ | ||
public IndexedDiff(Object actual, Object expected, int index) { | ||
this.actual = actual; | ||
this.expected = expected; | ||
this.index = index; | ||
} | ||
|
||
/** | ||
* Get the actual value of the diff. | ||
* @return {@link Object} containing the actual value of the diff. | ||
*/ | ||
public Object getActual() { | ||
return actual; | ||
} | ||
|
||
/** | ||
* Get the expected value of the diff. | ||
* @return {@link Object} containing the expected value of the diff. | ||
*/ | ||
public Object getExpected() { | ||
return expected; | ||
} | ||
|
||
/** | ||
* Get the index the diff occurred at. | ||
* @return {@code int} containing the index the diff occurred at. | ||
*/ | ||
public int getIndex() { | ||
return index; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters