01: /*
02: * Copyright 2001-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.commons.collections;
17:
18: import java.util.TreeMap;
19:
20: import org.apache.commons.collections.map.AbstractTestMap;
21:
22: /**
23: * Tests TreeMap.
24: *
25: * @version $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
26: *
27: * @author Jason van Zyl
28: */
29: public abstract class TestTreeMap extends AbstractTestMap {
30:
31: public TestTreeMap(String testName) {
32: super (testName);
33: }
34:
35: public static void main(String args[]) {
36: String[] testCaseName = { TestTreeMap.class.getName() };
37: junit.textui.TestRunner.main(testCaseName);
38: }
39:
40: public boolean isAllowNullKey() {
41: return false;
42: }
43:
44: protected TreeMap map = null;
45:
46: public void setUp() {
47: map = (TreeMap) makeEmptyMap();
48: }
49:
50: public void testNewMap() {
51: assertTrue("New map is empty", map.isEmpty());
52: assertEquals("New map has size zero", map.size(), 0);
53: }
54:
55: public void testSearch() {
56: map.put("first", "First Item");
57: map.put("second", "Second Item");
58: assertEquals("Top item is 'Second Item'", map.get("first"),
59: "First Item");
60: assertEquals("Next Item is 'First Item'", map.get("second"),
61: "Second Item");
62: }
63: }
|