This module contains a JUnit rule to record logback logging events and it works tightly together with hamcrest-logback-android
@Rule
public LogRecorder logRecorder = LogRecorder.expectedLogs(new LogSpec(SomeType.class, Level.ERROR));
@Test
public void shouldLogWhenDependentComponentFails() {
// given
someDependentComponent.failsToRun();
// when
someComponent.runsBusinessLogic();
// then
ILoggingEvent event = logRecorder.event();
assertThat(event, hasLevel(Level.ERROR));
assertThat(event, hasMessage("someDependentComponent failed"));
}