use of org.apache.logging.log4j.status.StatusLogger in project logging-log4j2 by apache.
the class AbstractActionTest method testErrorsAreLoggedToStatusLogger.
@Test
public void testErrorsAreLoggedToStatusLogger() {
StatusLogger statusLogger = StatusLogger.getLogger();
statusLogger.clear();
new AbstractAction() {
@Override
public boolean execute() {
throw new AssertionError();
}
}.run();
List<StatusData> statusDataList = statusLogger.getStatusData();
assertThat(statusDataList, hasSize(1));
StatusData statusData = statusDataList.get(0);
assertEquals(Level.WARN, statusData.getLevel());
String formattedMessage = statusData.getFormattedStatus();
assertThat(formattedMessage, containsString("Exception reported by action"));
}
Aggregations