public interface LogCaptor
Can either be used stand-alone for example
private LogCaptor logCaptor = new LogCaptor.DefaultLogCaptor(Level.INFO);
// Do stuff that you expect to log things
assertThat(logCaptor.loggedEvents(), is(not(empty())));
Or can extend it to make use of @Before / @After test annotations
class MyTestClass extends LogCaptor.LogCaptorTestBase {
@Test
public void someTestThatWeExpectToLog() {
// Do stuff that you expect to log things
assertThat(loggedEvents(), is(not(empty())));
}
}
Modifier and Type | Interface and Description |
---|---|
static class |
LogCaptor.DefaultLogCaptor |
static class |
LogCaptor.LogCaptorTestBase |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
List<LoggingEvent> |
loggedEvents() |
List<LoggingEvent> loggedEvents()
void clear()
Copyright © 2024. All rights reserved.