FileDocCategorySizeDatePackage
CategoryTest.javaAPI DocApache log4j 1.2.153149Sat Aug 25 00:09:34 BST 2007org.apache.log4j

CategoryTest

public class CategoryTest extends TestCase
Tests of Category.
author
Curt Arnold
since
1.2.14

Fields Summary
Constructors Summary
public CategoryTest(String name)
Constructs new instance of test.

param
name test name.

    super(name);
  
Methods Summary
public voidtestForcedLog()
Tests Category.forcedLog.

    MockCategory category = new MockCategory("org.example.foo");
    category.setAdditivity(false);
    category.addAppender(new VectorAppender());
    category.info("Hello, World");
  
public voidtestGetChainedPriorityReturnType()
Tests that the return type of getChainedPriority is Priority.

throws
Exception thrown if Category.getChainedPriority can not be found.

    Method method = Category.class.getMethod("getChainedPriority", (Class[]) null);
    assertTrue(method.getReturnType() == Priority.class);
  
public voidtestL7dlog()
Tests l7dlog(Priority, String, Throwable).

    Logger logger = Logger.getLogger("org.example.foo");
    logger.setLevel(Level.ERROR);
    Priority debug = Level.DEBUG;
    logger.l7dlog(debug, "Hello, World", null);
  
public voidtestL7dlog4Param()
Tests l7dlog(Priority, String, Object[], Throwable).

    Logger logger = Logger.getLogger("org.example.foo");
    logger.setLevel(Level.ERROR);
    Priority debug = Level.DEBUG;
    logger.l7dlog(debug, "Hello, World", new Object[0], null);
  
public voidtestSetPriority()
Tests setPriority(Priority).

deprecated

    Logger logger = Logger.getLogger("org.example.foo");
    Priority debug = Level.DEBUG;
    logger.setPriority(debug);