org.apache.commons.logging.log4j
Class StandardTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.logging.log4j.StandardTests
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
Log4j12StandardTests

public abstract class StandardTests
extends junit.framework.TestCase

Abstract set of tests that can be executed with various classpaths set.

The tests verify that when running on a system with Log4J present, Log4J is selected and that the logger basically works.


Nested Class Summary
static class StandardTests.LogEvent
          Simple structure to store information about messages that actually get logged by the underlying logging library.
 
Constructor Summary
StandardTests()
           
 
Method Summary
 void setUp()
          Set up instance variables required by this test case.
abstract  void setUpTestAppender(List logEvents)
          Modify log4j's setup so that all messages actually logged get redirected into the specified list.
 void tearDown()
          Tear down instance variables required by this test case.
 void testCreateFactory()
          Test that a LogFactory gets created as expected.
 void testExceptionMessages()
          Verify that we can log exception messages.
 void testPlainMessages()
          Verify that we can log messages without exceptions.
 void testSerializable()
          Test Serializability of Log instance
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardTests

public StandardTests()
Method Detail

setUp

public void setUp()
           throws Exception
Set up instance variables required by this test case.

Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

tearDown

public void tearDown()
Tear down instance variables required by this test case.

Overrides:
tearDown in class junit.framework.TestCase

setUpTestAppender

public abstract void setUpTestAppender(List logEvents)
                                throws Exception
Modify log4j's setup so that all messages actually logged get redirected into the specified list.

This method also sets the logging level to INFO so that we can test whether messages are getting properly filtered.

Throws:
Exception

testCreateFactory

public void testCreateFactory()
Test that a LogFactory gets created as expected.


testPlainMessages

public void testPlainMessages()
                       throws Exception
Verify that we can log messages without exceptions.

Throws:
Exception

testExceptionMessages

public void testExceptionMessages()
                           throws Exception
Verify that we can log exception messages.

Throws:
Exception

testSerializable

public void testSerializable()
                      throws Exception
Test Serializability of Log instance

Throws:
Exception


Copyright © 2001-2011 Apache Software Foundation. All Rights Reserved.