assert log in unit testing
public class FooServiceTest { private LogCaptor logCaptor = LogCaptor.forClass(FooService.class); @Test public void logInfoAndWarnMessages() { FooService fooService = new FooService(); fooService.sayHello(); assertThat(logCaptor.getWarnLogs()) .contains("Congratulations, you are pregnant!"); } }