Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: panguixin <[email protected]>
  • Loading branch information
bugmakerrrrrr committed Dec 12, 2024
1 parent 17940b9 commit 6550f60
Showing 1 changed file with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,25 @@ protected void doAssert(Object actualValue, Object expectedValue) {
}

if (expectedValue.equals(actualValue) == false) {
if (expectedValue instanceof ArrayList
&& actualValue instanceof ArrayList
&& ((ArrayList<?>) expectedValue).get(0) instanceof Number) {
ArrayList expectedList = (ArrayList) expectedValue;
ArrayList actualList = (ArrayList) actualValue;
if (expectedList.size() == 1
&& actualList.size() == 1
&& expectedList.get(0) instanceof Number
&& actualList.get(0) instanceof Number) {
// BigInteger 1 is equal to Integer 1
assertThat(
"field [" + getField() + "] doesn't match the expected value",
((Number) actualList.get(0)).longValue(),
equalTo(((Number) expectedList.get(0)).longValue())
);
return;
if (expectedValue instanceof ArrayList && actualValue instanceof ArrayList) {
ArrayList<?> expectedList = (ArrayList<?>) expectedValue;
ArrayList<?> actualList = (ArrayList<?>) actualValue;
if (expectedList.size() == actualList.size()) {
boolean pass = true;
for (int i = 0; i < expectedList.size(); i++) {
// BigInteger 1 is equal to Integer 1
Object expected = expectedList.get(i);
Object actual = actualList.get(i);
if (expected instanceof Number == false
|| actual instanceof Number == false
|| ((Number) expected).longValue() != ((Number) actual).longValue()) {
pass = false;
break;
}
}
if (pass) {
return;
}
}
}

Expand Down

0 comments on commit 6550f60

Please sign in to comment.