示例#1
0
  @Test
  public void testIsErrorEnabled() {
    org.apache.log4j.Logger mock = createStrictMock(org.apache.log4j.Logger.class);
    replay(mock);

    InternalLogger logger = new Log4JLogger(mock);
    assertTrue(logger.isErrorEnabled());
    verify(mock);
  }
示例#2
0
  @Test
  public void testInfo() {
    org.apache.log4j.Logger mock = createStrictMock(org.apache.log4j.Logger.class);

    mock.info("a");
    replay(mock);

    InternalLogger logger = new Log4JLogger(mock);
    logger.info("a");
    verify(mock);
  }
示例#3
0
  @Test
  public void testDebugWithException() {
    org.apache.log4j.Logger mock = createStrictMock(org.apache.log4j.Logger.class);

    mock.debug("a", e);
    replay(mock);

    InternalLogger logger = new Log4JLogger(mock);
    logger.debug("a", e);
    verify(mock);
  }
示例#4
0
  @Test
  public void testIsInfoEnabled() {
    org.apache.log4j.Logger mock = createStrictMock(org.apache.log4j.Logger.class);

    expect(mock.isInfoEnabled()).andReturn(true);
    replay(mock);

    InternalLogger logger = new Log4JLogger(mock);
    assertTrue(logger.isInfoEnabled());
    verify(mock);
  }
 @Test
 public void testCreation() {
   InternalLogger logger = new CommonsLoggerFactory().newInstance("foo");
   assertTrue(logger instanceof CommonsLogger);
   assertEquals("foo", logger.toString());
 }