Package software.amazon.awssdk.testutils
Interface LogCaptor
-
- All Superinterfaces:
AutoCloseable,SdkAutoCloseable
- All Known Implementing Classes:
LogCaptor.DefaultLogCaptor,LogCaptor.LogCaptorTestBase
public interface LogCaptor extends SdkAutoCloseable
A test utility that allows inspection of log statements during testing.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()))); } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classLogCaptor.DefaultLogCaptorstatic classLogCaptor.LogCaptorTestBase
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()static LogCaptorcreate()static LogCaptorcreate(org.apache.logging.log4j.Level level)List<org.apache.logging.log4j.core.LogEvent>loggedEvents()-
Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
-
-