Format nits
This commit is contained in:
@@ -25,94 +25,76 @@ import junit.framework.TestCase;
|
|||||||
* This is the minimum requirement for any well behaved logger
|
* This is the minimum requirement for any well behaved logger
|
||||||
* and so this test should be run for each kind.
|
* and so this test should be run for each kind.
|
||||||
*/
|
*/
|
||||||
public class BasicOperationsTestCase extends TestCase
|
public class BasicOperationsTestCase extends TestCase {
|
||||||
{
|
|
||||||
public void executeIsEnabledTest(final Log log)
|
public void executeIsEnabledTest(final Log log) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
log.isTraceEnabled();
|
log.isTraceEnabled();
|
||||||
log.isDebugEnabled();
|
log.isDebugEnabled();
|
||||||
log.isInfoEnabled();
|
log.isInfoEnabled();
|
||||||
log.isWarnEnabled();
|
log.isWarnEnabled();
|
||||||
log.isErrorEnabled();
|
log.isErrorEnabled();
|
||||||
log.isFatalEnabled();
|
log.isFatalEnabled();
|
||||||
}
|
} catch (final Throwable t) {
|
||||||
catch (final Throwable t)
|
|
||||||
{
|
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
fail("Exception thrown: " + t);
|
fail("Exception thrown: " + t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeMessageWithExceptionTest(final Log log)
|
public void executeMessageWithExceptionTest(final Log log) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
log.trace("Hello, Mum", new ArithmeticException());
|
log.trace("Hello, Mum", new ArithmeticException());
|
||||||
log.debug("Hello, Mum", new ArithmeticException());
|
log.debug("Hello, Mum", new ArithmeticException());
|
||||||
log.info("Hello, Mum", new ArithmeticException());
|
log.info("Hello, Mum", new ArithmeticException());
|
||||||
log.warn("Hello, Mum", new ArithmeticException());
|
log.warn("Hello, Mum", new ArithmeticException());
|
||||||
log.error("Hello, Mum", new ArithmeticException());
|
log.error("Hello, Mum", new ArithmeticException());
|
||||||
log.fatal("Hello, Mum", new ArithmeticException());
|
log.fatal("Hello, Mum", new ArithmeticException());
|
||||||
}
|
} catch (final Throwable t) {
|
||||||
catch (final Throwable t)
|
|
||||||
{
|
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
fail("Exception thrown: " + t);
|
fail("Exception thrown: " + t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeMessageWithoutExceptionTest(final Log log)
|
public void executeMessageWithoutExceptionTest(final Log log) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
log.trace("Hello, Mum");
|
log.trace("Hello, Mum");
|
||||||
log.debug("Hello, Mum");
|
log.debug("Hello, Mum");
|
||||||
log.info("Hello, Mum");
|
log.info("Hello, Mum");
|
||||||
log.warn("Hello, Mum");
|
log.warn("Hello, Mum");
|
||||||
log.error("Hello, Mum");
|
log.error("Hello, Mum");
|
||||||
log.fatal("Hello, Mum");
|
log.fatal("Hello, Mum");
|
||||||
}
|
} catch (final Throwable t) {
|
||||||
catch (final Throwable t)
|
|
||||||
{
|
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
fail("Exception thrown: " + t);
|
fail("Exception thrown: " + t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsEnabledClassLog()
|
public void testIsEnabledClassLog() {
|
||||||
{
|
|
||||||
final Log log = LogFactory.getLog(BasicOperationsTestCase.class);
|
final Log log = LogFactory.getLog(BasicOperationsTestCase.class);
|
||||||
executeIsEnabledTest(log);
|
executeIsEnabledTest(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsEnabledNamedLog()
|
public void testIsEnabledNamedLog() {
|
||||||
{
|
|
||||||
final Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
|
final Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
|
||||||
executeIsEnabledTest(log);
|
executeIsEnabledTest(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMessageWithExceptionClassLog()
|
public void testMessageWithExceptionClassLog() {
|
||||||
{
|
|
||||||
final Log log = LogFactory.getLog(BasicOperationsTestCase.class);
|
final Log log = LogFactory.getLog(BasicOperationsTestCase.class);
|
||||||
executeMessageWithExceptionTest(log);
|
executeMessageWithExceptionTest(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMessageWithExceptionNamedLog()
|
public void testMessageWithExceptionNamedLog() {
|
||||||
{
|
|
||||||
final Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
|
final Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
|
||||||
executeMessageWithExceptionTest(log);
|
executeMessageWithExceptionTest(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMessageWithoutExceptionClassLog()
|
public void testMessageWithoutExceptionClassLog() {
|
||||||
{
|
|
||||||
final Log log = LogFactory.getLog(BasicOperationsTestCase.class);
|
final Log log = LogFactory.getLog(BasicOperationsTestCase.class);
|
||||||
executeMessageWithoutExceptionTest(log);
|
executeMessageWithoutExceptionTest(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMessageWithoutExceptionNamedLog()
|
public void testMessageWithoutExceptionNamedLog() {
|
||||||
{
|
|
||||||
final Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
|
final Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName());
|
||||||
executeMessageWithoutExceptionTest(log);
|
executeMessageWithoutExceptionTest(log);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import junit.framework.TestCase;
|
|||||||
* test to emulate container and application isolated from container
|
* test to emulate container and application isolated from container
|
||||||
*/
|
*/
|
||||||
public class LoadTestCase extends TestCase {
|
public class LoadTestCase extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom classloader which "duplicates" logging classes available
|
* A custom classloader which "duplicates" logging classes available
|
||||||
* in the parent classloader into itself.
|
* in the parent classloader into itself.
|
||||||
|
|||||||
@@ -16,13 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.commons.logging;
|
package org.apache.commons.logging;
|
||||||
|
|
||||||
|
public class LogTestCase extends AbstractLogTest {
|
||||||
public class LogTestCase extends AbstractLogTest
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Log getLogObject()
|
public Log getLogObject() {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Pickup whatever is found/configured!
|
* Pickup whatever is found/configured!
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,11 +18,9 @@ package org.apache.commons.logging;
|
|||||||
|
|
||||||
import org.apache.commons.logging.impl.SimpleLog;
|
import org.apache.commons.logging.impl.SimpleLog;
|
||||||
|
|
||||||
public class SimpleLogTestCase extends AbstractLogTest
|
public class SimpleLogTestCase extends AbstractLogTest {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Log getLogObject()
|
public Log getLogObject() {
|
||||||
{
|
|
||||||
return new SimpleLog(this.getClass().getName());
|
return new SimpleLog(this.getClass().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ import org.apache.commons.logging.impl.NoOpLog;
|
|||||||
* <p>
|
* <p>
|
||||||
* This simply applies the tests defined in AbstractLogTest to this class.
|
* This simply applies the tests defined in AbstractLogTest to this class.
|
||||||
*/
|
*/
|
||||||
public class NoOpLogTestCase extends AbstractLogTest
|
public class NoOpLogTestCase extends AbstractLogTest {
|
||||||
{
|
|
||||||
private void checkLog(final Log log) {
|
private void checkLog(final Log log) {
|
||||||
|
|
||||||
assertNotNull("Log exists", log);
|
assertNotNull("Log exists", log);
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ import junit.framework.TestCase;
|
|||||||
* PathableClassLoader approach to ensure each test is run in its own
|
* PathableClassLoader approach to ensure each test is run in its own
|
||||||
* classloader, and use a separate test class for each test.
|
* classloader, and use a separate test class for each test.
|
||||||
*/
|
*/
|
||||||
public class SecurityAllowedTestCase extends TestCase
|
public class SecurityAllowedTestCase extends TestCase {
|
||||||
{
|
|
||||||
// Dummy special hashtable, so we can tell JCL to use this instead of
|
// Dummy special hashtable, so we can tell JCL to use this instead of
|
||||||
// the standard one.
|
// the standard one.
|
||||||
public static class CustomHashtable extends Hashtable {
|
public static class CustomHashtable extends Hashtable {
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ import junit.framework.TestCase;
|
|||||||
* PathableClassLoader approach to ensure each test is run in its own
|
* PathableClassLoader approach to ensure each test is run in its own
|
||||||
* classloader, and use a separate test class for each test.
|
* classloader, and use a separate test class for each test.
|
||||||
*/
|
*/
|
||||||
public class SecurityForbiddenTestCase extends TestCase
|
public class SecurityForbiddenTestCase extends TestCase {
|
||||||
{
|
|
||||||
// Dummy special hashtable, so we can tell JCL to use this instead of
|
// Dummy special hashtable, so we can tell JCL to use this instead of
|
||||||
// the standard one.
|
// the standard one.
|
||||||
public static class CustomHashtable extends Hashtable {
|
public static class CustomHashtable extends Hashtable {
|
||||||
|
|||||||
Reference in New Issue
Block a user