예제 #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);
  }
예제 #5
0
 @Test
 public void testCreation() {
   InternalLogger logger = new CommonsLoggerFactory().newInstance("foo");
   assertTrue(logger instanceof CommonsLogger);
   assertEquals("foo", logger.toString());
 }