How can I assert that a certain exception is thrown inside an @Async method?
Because the following exception is caught by Springs SimpleAsyncUncaughtExceptionHandler.
@Service
public class Service {
@Async
public void run() {
throw new RuntimeException();
}
}
public class Test {
@Test
public void test() {
assertDoesNotThrow(() -> service.run()); //this always passes
}
}