Example usage for org.apache.commons.logging Log isFatalEnabled

List of usage examples for org.apache.commons.logging Log isFatalEnabled

Introduction

In this page you can find the example usage for org.apache.commons.logging Log isFatalEnabled.

Prototype

boolean isFatalEnabled();

Source Link

Document

Is fatal logging currently enabled?

Usage

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testErrorNoEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.ERROR);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    logger.log(() -> "foo");
    verify(theLogger).isErrorEnabled();//w w  w .  j a  v a2 s  . c o  m
    verify(theLogger).error(any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testWarnNoEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.WARN);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    given(theLogger.isWarnEnabled()).willReturn(true);
    logger.log(() -> "foo");
    verify(theLogger).isWarnEnabled();//from  ww  w  . j  ava  2  s .c o m
    verify(theLogger).warn(any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testInfoNoEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.INFO);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    given(theLogger.isWarnEnabled()).willReturn(true);
    given(theLogger.isInfoEnabled()).willReturn(true);
    logger.log(() -> "foo");
    verify(theLogger).isInfoEnabled();//from  w  w  w.j  a  v a 2  s .co m
    verify(theLogger).info(any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testDebugNoEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.DEBUG);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    given(theLogger.isWarnEnabled()).willReturn(true);
    given(theLogger.isInfoEnabled()).willReturn(true);
    given(theLogger.isDebugEnabled()).willReturn(true);
    logger.log(() -> "foo");
    verify(theLogger).isDebugEnabled();/*from  w  w  w.  ja va2s.  c om*/
    verify(theLogger).debug(any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testTraceNoEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.TRACE);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    given(theLogger.isWarnEnabled()).willReturn(true);
    given(theLogger.isInfoEnabled()).willReturn(true);
    given(theLogger.isDebugEnabled()).willReturn(true);
    given(theLogger.isTraceEnabled()).willReturn(true);
    logger.log(() -> "foo");
    verify(theLogger).isTraceEnabled();//w w  w  .  j  a v  a 2  s  .c om
    verify(theLogger).trace(any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testFatalWithEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.FATAL);
    given(theLogger.isFatalEnabled()).willReturn(true);
    logger.log(() -> "foo", rte);
    verify(theLogger).isFatalEnabled();//from w  ww .  j a  v a2s .  c  om
    verify(theLogger).fatal(any(), any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testErrorWithEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.ERROR);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    logger.log(() -> "foo", rte);
    verify(theLogger).isErrorEnabled();//from   w w w.j a v  a 2 s  .com
    verify(theLogger).error(any(), any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testWarnWithEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.WARN);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    given(theLogger.isWarnEnabled()).willReturn(true);
    logger.log(() -> "foo", rte);
    verify(theLogger).isWarnEnabled();//  w w w. ja v  a 2 s.  c  om
    verify(theLogger).warn(any(), any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testInfoWithEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.INFO);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    given(theLogger.isWarnEnabled()).willReturn(true);
    given(theLogger.isInfoEnabled()).willReturn(true);
    logger.log(() -> "foo", rte);
    verify(theLogger).isInfoEnabled();//from   ww w.j  a v  a 2  s . c  om
    verify(theLogger).info(any(), any());
    verifyNoMoreInteractions(theLogger);
}

From source file:org.springframework.kafka.support.LogIfLevelEnabledTests.java

@Test
public void testDebugWithEx() {
    Log theLogger = mock(Log.class);
    LogIfLevelEnabled logger = new LogIfLevelEnabled(theLogger, LogIfLevelEnabled.Level.DEBUG);
    given(theLogger.isFatalEnabled()).willReturn(true);
    given(theLogger.isErrorEnabled()).willReturn(true);
    given(theLogger.isWarnEnabled()).willReturn(true);
    given(theLogger.isInfoEnabled()).willReturn(true);
    given(theLogger.isDebugEnabled()).willReturn(true);
    logger.log(() -> "foo", rte);
    verify(theLogger).isDebugEnabled();/*from  w w w  .j  a  v  a  2  s .  c o  m*/
    verify(theLogger).debug(any(), any());
    verifyNoMoreInteractions(theLogger);
}