ErrorHandlerTestCasepublic class ErrorHandlerTestCase extends TestCase
Fields Summary |
---|
static String | TEMP_A1 | static String | TEMP_A2 | static String | FILTERED_A1 | static String | FILTERED_A2 | static String | EXCEPTION1 | static String | EXCEPTION2 | static String | EXCEPTION3 | static String | TEST1_1A_PAT | static String | TEST1_1B_PAT | static String | TEST1_2_PAT | Logger | root | Logger | logger |
Constructors Summary |
---|
public ErrorHandlerTestCase(String name)
super(name);
|
Methods Summary |
---|
void | common()
int i = -1;
logger.debug("Message " + ++i);
root.debug("Message " + i);
logger.info ("Message " + ++i);
root.info("Message " + i);
logger.warn ("Message " + ++i);
root.warn("Message " + i);
logger.error("Message " + ++i);
root.error("Message " + i);
logger.log(Level.FATAL, "Message " + ++i);
root.log(Level.FATAL, "Message " + i);
Exception e = new Exception("Just testing");
logger.debug("Message " + ++i, e);
root.debug("Message " + i, e);
logger.error("Message " + ++i, e);
root.error("Message " + i, e);
| public void | setUp()
root = Logger.getRootLogger();
logger = Logger.getLogger("test");
| public static junit.framework.Test | suite()
TestSuite suite = new TestSuite();
suite.addTest(new ErrorHandlerTestCase("test1"));
return suite;
| public void | tearDown()
root.getLoggerRepository().resetConfiguration();
| public void | test1()
DOMConfigurator.configure("input/xml/fallback1.xml");
common();
ControlFilter cf1 = new ControlFilter(new String[]{TEST1_1A_PAT, TEST1_1B_PAT,
EXCEPTION1, EXCEPTION2, EXCEPTION3});
ControlFilter cf2 = new ControlFilter(new String[]{TEST1_2_PAT,
EXCEPTION1, EXCEPTION2, EXCEPTION3});
Transformer.transform(TEMP_A1, FILTERED_A1, new Filter[] {cf1,
new LineNumberFilter()});
Transformer.transform(TEMP_A2, FILTERED_A2, new Filter[] {cf2,
new LineNumberFilter(), new ISO8601Filter()});
assertTrue(Compare.compare(FILTERED_A1, "witness/dom.A1.1"));
assertTrue(Compare.compare(FILTERED_A2, "witness/dom.A2.1"));
|
|