Fixed match assertion that didn't run any assert with object of different types that don't extend Number
This commit is contained in:
parent
623e4a0fc8
commit
7166ab6b6f
|
@ -45,12 +45,12 @@ public class MatchAssertion extends Assertion {
|
|||
logger.trace("assert that [{}] matches [{}]", actualValue, expectedValue);
|
||||
if (!actualValue.getClass().equals(expectedValue.getClass())) {
|
||||
if (actualValue instanceof Number && expectedValue instanceof Number) {
|
||||
//Double 1.0 is equals to Integer 1
|
||||
//Double 1.0 is equal to Integer 1
|
||||
assertThat(errorMessage(), ((Number) actualValue).doubleValue(), equalTo(((Number) expectedValue).doubleValue()));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
assertThat(errorMessage(), actualValue, equalTo(expectedValue));
|
||||
}
|
||||
assertThat(errorMessage(), actualValue, equalTo(expectedValue));
|
||||
}
|
||||
|
||||
private String errorMessage() {
|
||||
|
|
Loading…
Reference in New Issue