Closed
Description
Feature Request / Improvement
We should ensure that test code asserting on exceptions should always check for the underlying exception message as shown below:
// should fail because it doesn't check for the underlying message
Assertions.assertThatThrownBy(() -> ...)
.isInstanceOf(ValidationException.class);
// should not fail as it checks for the exception message
Assertions.assertThatThrownBy(() -> ...)
.isInstanceOf(ValidationException.class)
.hasMessageContaining(...);
// should fail because it doesn't check for the underlying message
Assertions.assertThatExceptionOfType(NotFoundException.class)
.isThrownBy(() -> ...);
// should not fail as it checks for the exception message
Assertions.assertThatExceptionOfType(NotFoundException.class)
.isThrownBy(() -> ...)
.withMessageContaining(...);
Query engine
None