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
According to this random article I found, JUnit 5 has an assertThrows that returns the exception if a matching one is found (and fails otherwise), which is probably the ideal thing for this kind of test. JUnit 4 has the ExpectedException rule, but I don't think that it would be usable for this purpose.
The easiest approach, and one that already seems to be used by some of the existing tests, is to call fail() after the code that should throw the exception. That's easy enough that I'll look into making a PR for it.
Pokechu22
added a commit
to Pokechu22/brigadier
that referenced
this issue
Nov 12, 2021
Tests like these:
brigadier/src/test/java/com/mojang/brigadier/StringReaderTest.java
Lines 239 to 247 in cf754c4
will actually pass if no exception is thrown.
The text was updated successfully, but these errors were encountered: