1 /*
2 * Created on 2003-6-26 16:05:56 by joel guo
3 *
4 * vTradEx Information Technology Inc.
5 */
6 package com.cyclops.dbdigger.util;
7 import java.util.Iterator;
8
9 import junit.framework.TestCase;
10 /*** Add description <font color="red">HERE</font>!
11 *
12 * @author <a href="mailto:joeblack.guo@vtradex.com">joel guo</a>
13 * @since 2003-6-26 16:05:56
14 */
15 public class ArrayMapTest extends TestCase {
16 private ArrayMap instance;
17 /*** Override method setUp() of super class
18 * @see junit.framework.TestCase#setUp()
19 */
20 protected void setUp() throws Exception {
21 super.setUp();
22 instance = new ArrayMap();
23 instance.put("aaa", "aaaaaa");
24 instance.put("bbb", "bbbbbb");
25 instance.put("ccc", "cccccc");
26 instance.put("bbb", "rrrrrr");
27 }
28 /*** Method testClear()
29 *
30 */
31 public void testClear() {
32 instance.clear();
33 assertTrue(instance.keySet().isEmpty());
34 }
35 /*** Test key order */
36 public void testKeySet() {
37 Iterator it = instance.keySet().iterator();
38 String[] values = new String[] { "aaa", "ccc", "bbb" };
39 for (int i = 0; i < values.length; i++) {
40 String value = values[i];
41 assertEquals(value, it.next());
42 }
43 assertFalse(it.hasNext());
44 }
45 /*** Method testPutAll()
46 *
47 */
48 public void testPutAll() {
49 ArrayMap am = new ArrayMap();
50 am.put("aaa", "a");
51 am.put("eee", "e");
52 instance.putAll(am);
53 assertEquals(4, instance.size());
54 }
55 /*** Method testRemove() */
56 public void testRemove() {
57 instance.remove("aaa");
58 Iterator it = instance.keySet().iterator();
59 String[] values = new String[] { "ccc", "bbb" };
60 for (int i = 0; i < values.length; i++) {
61 String value = values[i];
62 assertEquals(value, it.next());
63 }
64 assertFalse(it.hasNext());
65 }
66 /*** Method testValues() */
67 public void testValues() {
68 Iterator it = instance.values().iterator();
69 String[] values = new String[] { "aaaaaa", "cccccc", "rrrrrr" };
70 for (int i = 0; i < values.length; i++) {
71 String value = values[i];
72 assertEquals(value, it.next());
73 }
74 assertFalse(it.hasNext());
75 }
76 }
This page was automatically generated by Maven