1
0

- Added new LogTest that exercises factory

- log statements now show implementation class
   (helpfull for visual verification that expected logger was found).


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138925 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard A. Sitze
2002-10-19 17:14:26 +00:00
parent a3566a19b7
commit dfcf03ab41
3 changed files with 78 additions and 17 deletions

View File

@@ -86,53 +86,58 @@ public abstract class AbstractLogTest extends TestCase {
assertNotNull(log);
log.debug(null);
log.debug(null, null);
log.debug("debug statement");
log.debug(log.getClass().getName() + ": debug statement");
log.debug(log.getClass().getName() + ": debug statement w/ null exception", new RuntimeException());
log.debug("debug statement w/ null exception", new RuntimeException());
log.error(null);
log.error(null, null);
log.error("error statement");
log.error(log.getClass().getName() + ": error statement");
log.error(log.getClass().getName() + ": error statement w/ null exception", new RuntimeException());
log.error("error statement w/ null exception", new RuntimeException());
log.fatal(null);
log.fatal(null, null);
log.fatal("fatal statement");
log.fatal(log.getClass().getName() + ": fatal statement");
log.fatal(log.getClass().getName() + ": fatal statement w/ null exception", new RuntimeException());
log.fatal("fatal statement w/ null exception", new RuntimeException());
log.info(null);
log.info(null, null);
log.info("info statement");
log.info(log.getClass().getName() + ": info statement");
log.info(log.getClass().getName() + ": info statement w/ null exception", new RuntimeException());
log.info("info statement w/ null exception", new RuntimeException());
log.trace(null);
log.trace(null, null);
log.trace("trace statement");
log.trace(log.getClass().getName() + ": trace statement");
log.trace(log.getClass().getName() + ": trace statement w/ null exception", new RuntimeException());
log.trace("trace statement w/ null exception", new RuntimeException());
log.warn(null);
log.warn(null, null);
log.warn("warn statement");
log.warn("warn statement w/ null exception", new RuntimeException());
log.warn(log.getClass().getName() + ": warn statement");
log.warn(log.getClass().getName() + ": warn statement w/ null exception", new RuntimeException());
}
}

View File

@@ -0,0 +1,55 @@
package org.apache.commons.logging;
import org.apache.commons.logging.impl.SimpleLog;
import junit.framework.*;
/**
*
*
*
*
*
*
*/
public class LogTest extends AbstractLogTest
{
/**
*
*
* @param testName
*
*/
public LogTest(String testName)
{
super(testName);
}
/**
*
*
*
*/
public Log getLogObject()
{
/**
* Pickup whatever is found/configured!
*/
return LogFactory.getLog(this.getClass().getName());
}
public static void main(String[] args)
{
String[] testCaseName = { LogTest.class.getName() };
junit.textui.TestRunner.main(testCaseName);
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(LogTest.class);
return suite;
}
}

View File

@@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/test/org/apache/commons/logging/TestAll.java,v 1.3 2002/10/11 04:53:21 sullis Exp $
* $Revision: 1.3 $
* $Date: 2002/10/11 04:53:21 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/test/org/apache/commons/logging/TestAll.java,v 1.4 2002/10/19 17:14:26 rsitze Exp $
* $Revision: 1.4 $
* $Date: 2002/10/19 17:14:26 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@ import junit.framework.*;
* coded by James Strachan. </p>
*
* @author Robert Burrell Donkin
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
public class TestAll extends TestCase {
@@ -88,6 +88,7 @@ public class TestAll extends TestCase {
suite.addTest(SimpleLogTest.suite());
suite.addTest(NoOpLogTest.suite());
suite.addTest(LogTest.suite());
return suite;
}