IT기술관련/테스트관련

stream way assertion and exception catch

ColinKang 2021. 5. 15. 12:53
@Test
public void anExceptionIsThrown() {
  String noString = null;
  Throwable exception = exceptionThrownBy(() -> noString.trim());
  assertEquals(NullPointerException.class, exception.getClass());
}

 

https://github.com/stefanbirkner/fishbowl

 

stefanbirkner/fishbowl

Fishbowl provides helper methods for dealing with exceptions. - stefanbirkner/fishbowl

github.com