01: /*
02: * ArgsHandlerTest.java
03: * JUnit based test
04: *
05: * Created on February 9, 2007, 4:16 PM
06: */
07:
08: package org.netbeans.projectopener;
09:
10: import junit.framework.TestCase;
11: import junit.framework.*;
12:
13: import java.util.ArrayList;
14: import java.util.List;
15:
16: /**
17: *
18: * @author Milan Kubec
19: */
20: public class ArgsHandlerTest extends TestCase {
21:
22: public ArgsHandlerTest(String testName) {
23: super (testName);
24: }
25:
26: /**
27: * Test of getArgValue method, of class org.netbeans.projectopener.ArgsHandler.
28: */
29: public void testGetArgValue() {
30:
31: System.out.println("getArgValue");
32:
33: String prjURLString = "http://www.someurl.com/TheProject.zip";
34: String nbVersionString = "1.2.3";
35: String mainPrjNameString = "TheMainProject";
36: String args[] = new String[] { "-projecturl", prjURLString,
37: "-minversion", nbVersionString, "-mainproject",
38: mainPrjNameString, "-showgui", "-otherarg" };
39: List<String> list = new ArrayList<String>();
40: list.add("showgui");
41: list.add("otherarg");
42:
43: ArgsHandler handler = new ArgsHandler(args);
44: assertEquals(prjURLString, handler.getArgValue("projecturl"));
45: assertEquals(nbVersionString, handler.getArgValue("minversion"));
46: assertEquals(mainPrjNameString, handler
47: .getArgValue("mainproject"));
48: assertEquals(list, handler.getAdditionalArgs());
49:
50: String args2[] = new String[] { "-projecturl", "-minversion",
51: nbVersionString, "-showgui" };
52: list.clear();
53: list.add("showgui");
54:
55: handler = new ArgsHandler(args2);
56: assertEquals(null, handler.getArgValue("projecturl"));
57: assertEquals(nbVersionString, handler.getArgValue("minversion"));
58: assertEquals(null, handler.getArgValue("mainproject"));
59: assertEquals(list, handler.getAdditionalArgs());
60:
61: }
62:
63: /**
64: * Test of getAdditionalArgs method, of class org.netbeans.projectopener.ArgsHandler.
65: */
66: // public void testGetAdditionalArgs() { }
67: }
|