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

📄 simplescripthandlertest.java

📁 jConfig,JAVA读取XML的开源项目
💻 JAVA
字号:
/*
 * LDAPHandlerTest.java
 * JUnit based test
 *
 * Created on 8. Dezember 2002, 23:45
 */

package org.jconfig.handler;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.jconfig.Configuration;

/**
 *
 * @author Administrator
 */
public class SimpleScriptHandlerTest extends TestCase {
    
    public SimpleScriptHandlerTest(java.lang.String testName) {
        super(testName);
    }
    
    public void setUp() {
    	//ConfigurationManager.
    }
    
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
    
    public static Test suite() {
        TestSuite suite = new TestSuite(SimpleScriptHandlerTest.class);
        return suite;
    }
    
    public void testLoad() {
        SimpleScriptHandler scriptHandler = new SimpleScriptHandler();
        try {
            Configuration cfg = scriptHandler.load("simple");
            assertNotNull(cfg);
            String val = cfg.getProperty("hello");
            assertEquals("world",val);
            val = cfg.getProperty("val1","unknown","mycategory");
            assertEquals("100",val);
        }
        catch (Exception e) {
            e.printStackTrace();
            fail("unexpected exception");
        }
    }
	
	public void testSave() {
        SimpleScriptHandler scriptHandler = new SimpleScriptHandler();
        try {
            Configuration cfg = scriptHandler.load("simple");
            assertNotNull(cfg);
			cfg.setProperty("save","now");
			//System.out.println(cfg);
			scriptHandler.store(cfg);
			cfg = scriptHandler.load("simple");
            assertEquals("world",cfg.getProperty("hello"));
			assertEquals("now",cfg.getProperty("save"));
            assertEquals("100",cfg.getProperty("val1","unknown","mycategory"));
        }
        catch (Exception e) {
            e.printStackTrace();
            fail("unexpected exception");
        }
    }
}

⌨️ 快捷键说明

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