org.apache.commons.logging.simple
Class CustomConfigTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.logging.simple.DefaultConfigTestCase
              extended by org.apache.commons.logging.simple.CustomConfigTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
DateTimeCustomConfigTestCase

public class CustomConfigTestCase
extends DefaultConfigTestCase

TestCase for simple logging when running with custom configuration properties.

Version:
$Revision: 563165 $ $Date: 2007-08-06 17:08:05 +0200 $
Author:
Craig R. McClanahan

Field Summary
protected  List expected
          The expected log records.
protected  String[] testMessages
          The message strings that should have been logged.
 
Fields inherited from class org.apache.commons.logging.simple.DefaultConfigTestCase
factory, log
 
Constructor Summary
CustomConfigTestCase()
           
 
Method Summary
protected  void checkDecorated()
           
protected  void checkDecoratedDateTime()
          Hook for subclasses
protected  void checkExpected()
           
protected  void checkShowDateTime()
          Hook for subclassses
protected  void checkStandard()
           
protected  void logExceptionMessages()
           
protected  void logPlainMessages()
           
 void setProperties()
          Set system properties that will control the LogFactory/Log objects when they are created.
 void setUp()
          Set up instance variables required by this test case.
static junit.framework.Test suite()
          Return the tests included in this test suite.
 void tearDown()
          Tear down instance variables required by this test case.
 void testExceptionMessages()
           
 void testPlainMessages()
           
 void testSerializable()
           
 
Methods inherited from class org.apache.commons.logging.simple.DefaultConfigTestCase
setUpDecorated, setUpFactory, setUpLog, testPristineDecorated, testPristineFactory, testPristineLog
 
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
 

Field Detail

expected

protected List expected

The expected log records.


testMessages

protected String[] testMessages

The message strings that should have been logged.

Constructor Detail

CustomConfigTestCase

public CustomConfigTestCase()
Method Detail

setProperties

public void setProperties()
Set system properties that will control the LogFactory/Log objects when they are created. Subclasses can override this method to define properties that suit them.

Overrides:
setProperties in class DefaultConfigTestCase

setUp

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

Overrides:
setUp in class DefaultConfigTestCase
Throws:
Exception

suite

public static junit.framework.Test suite()
                                  throws Exception
Return the tests included in this test suite.

We need to use a PathableClassLoader here because the SimpleLog class is a pile of junk and chock-full of static variables. Any other test (like simple.CustomConfigTestCase) that has used the SimpleLog class will already have caused it to do once-only initialisation that we can't reset, even by calling LogFactory.releaseAll, because of those ugly statics. The only clean solution is to load a clean copy of commons-logging including SimpleLog via a nice clean classloader. Or we could fix SimpleLog to be sane...

Throws:
Exception

tearDown

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

Overrides:
tearDown in class DefaultConfigTestCase

testExceptionMessages

public void testExceptionMessages()
                           throws Exception
Throws:
Exception

testPlainMessages

public void testPlainMessages()
                       throws Exception
Throws:
Exception

testSerializable

public void testSerializable()
                      throws Exception
Overrides:
testSerializable in class DefaultConfigTestCase
Throws:
Exception

checkDecorated

protected void checkDecorated()
Overrides:
checkDecorated in class DefaultConfigTestCase

checkShowDateTime

protected void checkShowDateTime()
Hook for subclassses


checkDecoratedDateTime

protected void checkDecoratedDateTime()
Hook for subclasses


checkExpected

protected void checkExpected()

checkStandard

protected void checkStandard()
Overrides:
checkStandard in class DefaultConfigTestCase

logExceptionMessages

protected void logExceptionMessages()

logPlainMessages

protected void logPlainMessages()


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