?? pluginmanagertest.java
字號(hào):
package com.ecyrd.jspwiki.plugin;import com.ecyrd.jspwiki.*;import junit.framework.*;import java.util.*;public class PluginManagerTest extends TestCase{ public static final String NAME1 = "Test1"; Properties props = new Properties(); WikiEngine engine; WikiContext context; PluginManager manager; public PluginManagerTest( String s ) { super( s ); } public void setUp() throws Exception { props.load( TestEngine.findTestProperties() ); engine = new TestEngine(props); context = new WikiContext( engine, new WikiPage("testpage") ); manager = new PluginManager( props ); } public void tearDown() { } public void testSimpleInsert() throws Exception { String res = manager.execute( context, "{INSERT com.ecyrd.jspwiki.plugin.SamplePlugin WHERE text=foobar}"); assertEquals( "foobar", res ); } public void testSimpleInsertNoPackage() throws Exception { String res = manager.execute( context, "{INSERT SamplePlugin WHERE text=foobar}"); assertEquals( "foobar", res ); } public void testSimpleInsertNoPackage2() throws Exception { props.setProperty( PluginManager.PROP_SEARCHPATH, "com.foo" ); PluginManager m = new PluginManager( props ); String res = m.execute( context, "{INSERT SamplePlugin2 WHERE text=foobar}"); assertEquals( "foobar", res ); } public void testSimpleInsertNoPackage3() throws Exception { props.setProperty( PluginManager.PROP_SEARCHPATH, "com.foo" ); PluginManager m = new PluginManager( props ); String res = m.execute( context, "{INSERT SamplePlugin3 WHERE text=foobar}"); assertEquals( "foobar", res ); } /** Check that in all cases com.ecyrd.jspwiki.plugin is searched. */ public void testSimpleInsertNoPackage4() throws Exception { props.setProperty( PluginManager.PROP_SEARCHPATH, "com.foo,blat.blaa" ); PluginManager m = new PluginManager( props ); String res = m.execute( context, "{INSERT SamplePlugin WHERE text=foobar}"); assertEquals( "foobar", res ); } public void testSimpleInsert2() throws Exception { String res = manager.execute( context, "{INSERT com.ecyrd.jspwiki.plugin.SamplePlugin WHERE text = foobar2, moo=blat}"); assertEquals( "foobar2", res ); } /** Missing closing brace */ public void testSimpleInsert3() throws Exception { String res = manager.execute( context, "{INSERT com.ecyrd.jspwiki.plugin.SamplePlugin WHERE text = foobar2, moo=blat"); assertEquals( "foobar2", res ); } public void testQuotedArgs() throws Exception { String res = manager.execute( context, "{INSERT SamplePlugin WHERE text='this is a space'}"); assertEquals( "this is a space", res ); } public void testQuotedArgs2() throws Exception { String res = manager.execute( context, "{INSERT SamplePlugin WHERE text='this \\'is a\\' space'}"); assertEquals( "this 'is a' space", res ); } public void testNumberArgs() throws Exception { String res = manager.execute( context, "{INSERT SamplePlugin WHERE text=15}"); assertEquals( "15", res ); } public void testNoInsert() throws Exception { String res = manager.execute( context, "{SamplePlugin WHERE text=15}"); assertEquals( "15", res ); } public static Test suite() { return new TestSuite( PluginManagerTest.class ); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -