Hi,
I’ve noticed a few tests that are like so:
@Test
public void ofBytes() {
assertEquals("0", DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE,
NULL_BYTE).toString());
assertThrows(IllegalArgumentException.class, () ->
DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE));
}
That are using static
org.apache.plc4x.java.ads.util.Junit5Backport.assertThrows class. Any reason
why?
Wouldn’t it be easier to go with something like this? (not tested)
@Test
public void ofBytesJustRight() {
assertThat(DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE,
NULL_BYTE).toString(), is(“0”));
}
@Test(expected = IllegalArgumentException.class)
public void ofBytesTooMany() {
DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE);
}
(Could be a single test but it's really testing two things so should be
seperate tests IMO)
Also perhaps it would of been a good idea to discuss this on the list first?
Don’t get me wrong having tests is far better than not having tests and it's
good we have them, but if we’re doing things in a non standard way it’s best to
discuss on list first.
Thanks,
Justin