001: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
002:
003: This file is part of the db4o open source object database.
004:
005: db4o is free software; you can redistribute it and/or modify it under
006: the terms of version 2 of the GNU General Public License as published
007: by the Free Software Foundation and as clarified by db4objects' GPL
008: interpretation policy, available at
009: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011: Suite 350, San Mateo, CA 94403, USA.
012:
013: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014: WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: for more details.
017:
018: You should have received a copy of the GNU General Public License along
019: with this program; if not, write to the Free Software Foundation, Inc.,
020: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
021: package com.db4o.db4ounit.jre5.collections;
022:
023: import com.db4o.collections.ArrayMap4;
024:
025: import db4ounit.Assert;
026: import db4ounit.TestLifeCycle;
027: import db4ounit.TestRunner;
028:
029: public class ArrayMap4TestCase implements TestLifeCycle {
030:
031: private ArrayMap4<String, Integer> map;
032:
033: public static void main(String[] args) {
034: new TestRunner(ArrayMap4TestCase.class).run();
035: }
036:
037: public void setUp() throws Exception {
038: map = new ArrayMap4<String, Integer>();
039: ArrayMap4Asserter.putData(map);
040: }
041:
042: public void tearDown() throws Exception {
043: map.clear();
044: }
045:
046: // Function Test
047: public void testConstructor() {
048: ArrayMap4<String, Integer> m = new ArrayMap4<String, Integer>();
049: ArrayMap4Asserter.assertInitalStatus(m);
050: }
051:
052: public void testClear() {
053: ArrayMap4Asserter.assertClear(map);
054: }
055:
056: public void testClone() {
057: ArrayMap4Asserter.assertClone(map);
058: }
059:
060: public void testContainsKey() {
061: ArrayMap4Asserter.assertContainsKey(map);
062: }
063:
064: public void testContainsValue() {
065: ArrayMap4Asserter.assertContainsValue(map);
066: }
067:
068: public void testEntrySet() {
069: ArrayMap4Asserter.assertEntrySet(map);
070: }
071:
072: public void testGet() {
073: ArrayMap4Asserter.assertGet(map);
074: }
075:
076: public void testIsEmpty() {
077: ArrayMap4Asserter.assertIsEmpty(map);
078: }
079:
080: public void testKeySet() {
081: ArrayMap4Asserter.assertKeySet(map);
082: }
083:
084: public void testPut() {
085: ArrayMap4Asserter.assertPut(map);
086: }
087:
088: public void testPutAll() {
089: ArrayMap4Asserter.assertPutAll(map);
090: }
091:
092: public void testRemove() {
093: ArrayMap4<String, String> m = new ArrayMap4<String, String>();
094: m.put("one", "yi");
095: m.put("two", "er");
096: Assert.areEqual(2, m.size());
097: String value = m.remove("one");
098: Assert.areEqual("yi", value);
099: Assert.areEqual(1, m.size());
100: Assert.isNull(m.get("one"));
101:
102: value = m.remove("three");
103: Assert.isNull(value);
104: Assert.areEqual(1, m.size());
105:
106: value = m.remove("two");
107: Assert.areEqual("er", value);
108: Assert.areEqual(0, m.size());
109: Assert.isNull(m.get("two"));
110:
111: m.put("three", "san");
112: Assert.areEqual(1, m.size());
113:
114: }
115:
116: public void testRemove_FromHead() {
117: ArrayMap4Asserter.assertRemove_FromHead(map);
118: }
119:
120: public void testRemove_FromEnd() {
121: ArrayMap4Asserter.assertRemove_FromEnd(map);
122: }
123:
124: public void testRemove_FromMiddle() {
125: ArrayMap4Asserter.assertRemove_FromMiddle(map);
126: }
127:
128: public void testSize() {
129: ArrayMap4Asserter.assertSize(map);
130: }
131:
132: public void testValues() {
133: ArrayMap4Asserter.assertValues(map);
134: }
135:
136: public void testEquals() {
137: ArrayMap4Asserter.assertEquals(map);
138: }
139:
140: public void testIncreaseSize() {
141: ArrayMap4Asserter.assertIncreaseSize(map);
142: }
143: }
|