Java testing notes
Codearte’s Catch exception
The only thing it does, it’s to do a bit easier to test and assert for exceptions in a Test Driven Development-like way. To use together with AssertJ. It only has two methods which are useful to me:
// When
BDDCatchException.when(this.instance)
.methodWhichThrowsException();
// Then
Assertions
.assertThat(BDDCatchException.caughtException())
.isNotNull()
.isExactlyInstanceOf(IndexOutOfBoundsException.class);