public interface LogCaptor extends SdkAutoCloseable
Can either be used stand-alone for example
try (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<org.apache.log4j.spi.LoggingEvent> |
loggedEvents() |
close
List<org.apache.log4j.spi.LoggingEvent> loggedEvents()
void clear()
Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.