You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is an example of a JUnit 5 test displaying this issue:
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import org.junit.jupiter.api.Test;
public class ExampleTest {
@Test
void testByte() {
assertThat((byte) 5, is(equalTo(5))); // Error message is bad
}
@Test
void testShort() {
assertThat((short) 5, is(equalTo(5))); // Error message is good
}
}
From testShort the error message is good: (Note: <5s>)
Expected: is <5>
but: was <5s>
But from testByte you get:
Expected: is <5>
but: was <5>
Which looks ok <5> is <5>! Of course the reason the failed is the types are mismatched so the failure is correct, but it would be good to show this more clearly in the message.
The text was updated successfully, but these errors were encountered:
jamesmudd
added a commit
to jamesmudd/JavaHamcrest
that referenced
this issue
Apr 17, 2019
Here is an example of a JUnit 5 test displaying this issue:
From
testShort
the error message is good: (Note: <5s>)But from
testByte
you get:Which looks ok
<5>
is<5>
! Of course the reason the failed is the types are mismatched so the failure is correct, but it would be good to show this more clearly in the message.The text was updated successfully, but these errors were encountered: