Package org.jzonic.jlo.error

Source Code of org.jzonic.jlo.error.ErrorHandlerTest

/*
* 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");
        }
    }
   
   
   
}
TOP

Related Classes of org.jzonic.jlo.error.ErrorHandlerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.