KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > java2html > plugin > jspwiki > test > PluginParameterCheckerTest


1 package de.java2html.plugin.jspwiki.test;
2
3 import java.util.HashMap JavaDoc;
4
5 import com.ecyrd.jspwiki.plugin.PluginException;
6
7 import de.java2html.plugin.jspwiki.PluginParameter;
8 import de.java2html.plugin.jspwiki.PluginParameterChecker;
9 import junit.framework.TestCase;
10
11 /**
12  * @author Markus Gebhard
13  */

14 public class PluginParameterCheckerTest extends TestCase {
15   private HashMap JavaDoc parameters = new HashMap JavaDoc();
16
17   public void testEmptyParameterListIsSupported() throws PluginException {
18     new PluginParameterChecker().checkParametersSupported(parameters);
19   }
20
21   public void testInternalParameterIsSupported() throws PluginException {
22     parameters.put("_body", "");
23     new PluginParameterChecker().checkParametersSupported(parameters);
24   }
25
26   public void testIllegalParameterIsNotSupported() {
27     try {
28       parameters.put("A very unsupported parameter am I", "");
29       new PluginParameterChecker().checkParametersSupported(parameters);
30       fail();
31     }
32     catch (PluginException expected) {
33       //expected
34
}
35   }
36
37   public void testValidParameterIsSupported() throws PluginException {
38     parameters.put(PluginParameter.SOURCE.getName(), "");
39     new PluginParameterChecker().checkParametersSupported(parameters);
40   }
41
42   public void testNonStringObjectIsSupported() throws PluginException {
43     parameters.put(new Integer JavaDoc(42), "");
44     new PluginParameterChecker().checkParametersSupported(parameters);
45   }
46  }
Popular Tags