1   package net.kwfgrid.gworkflowdl;
2   
3   import junit.framework.Assert;
4   import junit.framework.Test;
5   import junit.framework.TestSuite;
6   import net.kwfgrid.gworkflowdl.structure.Factory;
7   import net.kwfgrid.gworkflowdl.structure.GenericProperties;
8   import net.kwfgrid.gworkflowdl.structure.Property;
9   
10  /***
11   * Created by IntelliJ IDEA.
12   * User: hans
13   * Date: 07.10.2005
14   * Time: 10:21:59
15   * To change this template use File | Settings | File Templates.
16   */
17  public class PropertiesTest extends AbstractTestCase {
18      /***
19       * Create the test case
20       *
21       * @param testName name of the test case
22       */
23      public PropertiesTest(String testName) {
24          super(testName);
25      }
26  
27      /***
28       * @return the suite of tests being tested
29       */
30      public static Test suite() {
31          return new TestSuite(PropertiesTest.class);
32      }
33  
34      /***
35       * Rigourous Test :-).
36       */
37      public void testApp() {
38          GenericProperties gp = Factory.newProperties();
39          String s = gp.get("sonnenschein");
40          Assert.assertEquals(s, null);
41          gp.put("a", "A");
42          s = gp.get("a");
43          Assert.assertEquals(s, "A");
44          s = gp.put("a", "AA");
45          Assert.assertEquals(s, "A");
46          s = gp.put("b", "BB");
47          Assert.assertEquals(s, null);
48          Property[] ss = gp.getProperties();
49          String s0k = ss[0].getKey();
50          String s0v = ss[0].getValue();
51          String s1k = ss[1].getKey();
52          String s1v = ss[1].getValue();
53          Assert.assertEquals(gp.size(), 2);
54          Assert.assertEquals(s0k, "a");
55          Assert.assertEquals(s0v, "AA");
56          Assert.assertEquals(s1k, "b");
57          Assert.assertEquals(s1v, "BB");
58  
59          s = gp.remove("a");
60          Assert.assertEquals(s, "AA");
61          ss = gp.getProperties();
62          Assert.assertEquals(gp.size(), 1);
63          Assert.assertEquals(ss[0].getKey(), "b");
64  
65      }
66  
67  
68  }