⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errorhandlertest.java

📁 jConfig,JAVA读取XML的开源项目
💻 JAVA
字号:
/*
 * Created on 28.06.2004
 * Created by crappy eclipse.
 */
package org.jconfig.error;

import junit.framework.TestCase;

import org.jconfig.Configuration;
import org.jconfig.ConfigurationManager;

/**
 * @author Mecky
 * shoot me because I am using eclipse
 */
public class ErrorHandlerTest extends TestCase {
	
	
	public ErrorHandlerTest(String arg0) {
		super(arg0);
	}

	public static void main(String[] args) {
		junit.textui.TestRunner.run(ErrorHandlerTest.class);
	}
	
	/* (non-Javadoc)
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
	}
	/* (non-Javadoc)
	 * @see junit.framework.TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	public void testErrorHandler() {
		System.setProperty("jconfig.errorhandler","org.jconfig.error.MockErrorHandler");
		Configuration cfg = ConfigurationManager.getConfiguration("I do not exist");
		assertNotNull(cfg);
		MockErrorHandler handler = (MockErrorHandler)ErrorReporter.getErrorHandler();
		assertEquals("Problem while trying to read configuration. Returning new configuration.",handler.getMsg());		
		System.setProperty("jconfig.errorhandler","blabla");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -