/*
* LogManagerTest.java
* JUnit based test
*
* Created on 25. November 2002, 22:56
*/
package org.jzonic.jlo.error;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jzonic.jlo.LogConfiguration;
import org.jzonic.jlo.reader.*;
import java.util.List;
/**
*
* @author Administrator
*/
public class ErrorHandlerTest extends TestCase {
public ErrorHandlerTest(java.lang.String testName) {
super(testName);
}
public static void main(java.lang.String[] args) {
junit.textui.TestRunner.run(suite());
}
public static Test suite() {
TestSuite suite = new TestSuite(ErrorHandlerTest.class);
return suite;
}
public void testBrokenConfiguration() {
System.setProperty("jlo.errorhandler","org.jzonic.jlo.error.MockErrorReporter");
try {
XMLFileReader reader = new XMLFileReader();
reader.setFileName("broken_logging.xml");
LogConfiguration lc = reader.parseConfiguration("broken_test");
assertNotNull( lc );
MockErrorReporter mer = (MockErrorReporter)ErrorHandlerFactory.getErrorReporter();
List all = mer.getMessages();
assertEquals(3,all.size());
}
catch (Exception e) {
e.printStackTrace();
fail("unexpected exception");
}
}
}