Open
Description
What happened?
Code of the form
byte b = (byte) 0;
assertEquals(b, 0);
passes under JUnit assertions. However, this is re-written as
byte b = (byte) 0;
assertThat(b).isEqualTo(0);
and this fails in AssertJ assertions, because the 0
there is an int, not a byte.
What did you want to happen?
The check notes that the variable being asserted on is a byte, and thus casts the integer to a byte
byte b = (byte) 0;
assertThat(b).isEqualTo((byte) 0);
There is a related case I don't know how/if you want to deal with something like
byte b = (byte) 0;
assertNotEquals(b, 88888888); // wat
since the naïve impl will not compile. Maybe just remove the line since it's always going to be true? (Someone somewhere who uses that kind of code to throw an AssertionError
is screaming at me...)
Metadata
Metadata
Assignees
Labels
No labels