Class InMemoryAppenderAssertions
- java.lang.Object
-
- org.kiwiproject.beta.test.logback.InMemoryAppenderAssertions
-
@Beta public class InMemoryAppenderAssertions extends Object
AssertJ assertions forInMemoryAppender.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ch.qos.logback.classic.spi.ILoggingEvent>andGetOrderedEvents()A terminal method if you want to get the actual logging events after performing assertions, for example to perform additional inspections.static InMemoryAppenderAssertionsassertThat(InMemoryAppender appender)Begin assertions for anInMemoryAppender.InMemoryAppenderAssertionscontainsMessage(String message)Assert this appender contains the given message at least once (but possibly more than once).InMemoryAppenderAssertionshasNumberOfLoggingEvents(int expectedEventCount)Assert this appender has the expected number of logging events, and if the assertion succeeds, return this instance to continue chaining assertions.List<ch.qos.logback.classic.spi.ILoggingEvent>hasNumberOfLoggingEventsAndGet(int expectedEventCount)Assert this appender has the expected number of logging events, and if the assertion succeeds, return a list containing those events.
-
-
-
Method Detail
-
assertThat
public static InMemoryAppenderAssertions assertThat(InMemoryAppender appender)
Begin assertions for anInMemoryAppender.- Parameters:
appender- the appender to assert against- Returns:
- a new InMemoryAppenderAssertions instance
-
hasNumberOfLoggingEventsAndGet
public List<ch.qos.logback.classic.spi.ILoggingEvent> hasNumberOfLoggingEventsAndGet(int expectedEventCount)
Assert this appender has the expected number of logging events, and if the assertion succeeds, return a list containing those events.- Returns:
- a List containing the logging events
-
hasNumberOfLoggingEvents
public InMemoryAppenderAssertions hasNumberOfLoggingEvents(int expectedEventCount)
Assert this appender has the expected number of logging events, and if the assertion succeeds, return this instance to continue chaining assertions.- Returns:
- this instance
-
containsMessage
public InMemoryAppenderAssertions containsMessage(String message)
Assert this appender contains the given message at least once (but possibly more than once).- Parameters:
message- the exact message to find- Returns:
- this instance
-
andGetOrderedEvents
public List<ch.qos.logback.classic.spi.ILoggingEvent> andGetOrderedEvents()
A terminal method if you want to get the actual logging events after performing assertions, for example to perform additional inspections. Does not perform any assertions.- Returns:
- a List containing the logging events
-
-