01: package de.java2html.plugin.jspwiki.test;
02:
03: import java.util.HashMap;
04:
05: import com.ecyrd.jspwiki.plugin.PluginException;
06:
07: import de.java2html.plugin.jspwiki.PluginParameter;
08: import de.java2html.plugin.jspwiki.PluginParameterChecker;
09: import junit.framework.TestCase;
10:
11: /**
12: * @author Markus Gebhard
13: */
14: public class PluginParameterCheckerTest extends TestCase {
15: private HashMap parameters = new HashMap();
16:
17: public void testEmptyParameterListIsSupported()
18: throws PluginException {
19: new PluginParameterChecker()
20: .checkParametersSupported(parameters);
21: }
22:
23: public void testInternalParameterIsSupported()
24: throws PluginException {
25: parameters.put("_body", "");
26: new PluginParameterChecker()
27: .checkParametersSupported(parameters);
28: }
29:
30: public void testIllegalParameterIsNotSupported() {
31: try {
32: parameters.put("A very unsupported parameter am I", "");
33: new PluginParameterChecker()
34: .checkParametersSupported(parameters);
35: fail();
36: } catch (PluginException expected) {
37: //expected
38: }
39: }
40:
41: public void testValidParameterIsSupported() throws PluginException {
42: parameters.put(PluginParameter.SOURCE.getName(), "");
43: new PluginParameterChecker()
44: .checkParametersSupported(parameters);
45: }
46:
47: public void testNonStringObjectIsSupported() throws PluginException {
48: parameters.put(new Integer(42), "");
49: new PluginParameterChecker()
50: .checkParametersSupported(parameters);
51: }
52: }
|