Skip to content
This repository has been archived by the owner on Aug 8, 2020. It is now read-only.

Latest commit

 

History

History

junit-logback-android

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

cherry-logo JUnit Logback for Andriod Maven Central

This module contains a JUnit rule to record logback logging events and it works tightly together with hamcrest-logback-android

Usage

@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"));
}