📅  最后修改于: 2022-03-11 14:52:40.188000             🧑  作者: Mango
Throwable exceptionThatWasThrown = assertThrows(NullPointerException.class, () -> {
codeThatThrows;
});
assertThat(exceptionThatWasThrown.getMessage(), equalTo("Message I expected to be thrown"));