KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > primitives > adapters > TestListDoubleList


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.commons.collections.primitives.adapters;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.AbstractList JavaDoc;
21 import java.util.ArrayList JavaDoc;
22
23 import junit.framework.Test;
24 import junit.framework.TestSuite;
25
26 import org.apache.commons.collections.BulkTest;
27 import org.apache.commons.collections.primitives.DoubleList;
28 import org.apache.commons.collections.primitives.TestDoubleList;
29
30 /**
31  * @version $Revision: 480451 $ $Date: 2006-11-28 23:45:08 -0800 (Tue, 28 Nov 2006) $
32  * @author Rodney Waldhoff
33  */

34 public class TestListDoubleList extends TestDoubleList {
35
36     // conventional
37
// ------------------------------------------------------------------------
38

39     public TestListDoubleList(String JavaDoc testName) {
40         super(testName);
41     }
42
43     public static Test suite() {
44         TestSuite suite = BulkTest.makeSuite(TestListDoubleList.class);
45         return suite;
46     }
47
48     // collections testing framework
49
// ------------------------------------------------------------------------
50

51     /**
52      * @see org.apache.commons.collections.primitives.TestDoubleList#makeEmptyDoubleList()
53      */

54     protected DoubleList makeEmptyDoubleList() {
55         return new ListDoubleList(new ArrayList JavaDoc());
56     }
57     
58     public String JavaDoc[] ignoredTests() {
59         // sublists are not serializable
60
return new String JavaDoc[] {
61             "TestListDoubleList.bulkTestSubList.testFullListSerialization",
62             "TestListDoubleList.bulkTestSubList.testEmptyListSerialization",
63             "TestListDoubleList.bulkTestSubList.testCanonicalEmptyCollectionExists",
64             "TestListDoubleList.bulkTestSubList.testCanonicalFullCollectionExists",
65             "TestListDoubleList.bulkTestSubList.testEmptyListCompatibility",
66             "TestListDoubleList.bulkTestSubList.testFullListCompatibility",
67             "TestListDoubleList.bulkTestSubList.testSerializeDeserializeThenCompare",
68             "TestListDoubleList.bulkTestSubList.testSimpleSerialization"
69         };
70     }
71
72     // tests
73
// ------------------------------------------------------------------------
74

75     /** @TODO need to add serialized form to cvs */
76     public void testCanonicalEmptyCollectionExists() {
77         // XXX FIX ME XXX
78
// need to add a serialized form to cvs
79
}
80
81     public void testCanonicalFullCollectionExists() {
82         // XXX FIX ME XXX
83
// need to add a serialized form to cvs
84
}
85
86     public void testEmptyListCompatibility() {
87         // XXX FIX ME XXX
88
// need to add a serialized form to cvs
89
}
90
91     public void testFullListCompatibility() {
92         // XXX FIX ME XXX
93
// need to add a serialized form to cvs
94
}
95     public void testWrapNull() {
96         assertNull(ListDoubleList.wrap(null));
97     }
98     
99     public void testWrapSerializable() {
100         DoubleList list = ListDoubleList.wrap(new ArrayList JavaDoc());
101         assertNotNull(list);
102         assertTrue(list instanceof Serializable JavaDoc);
103     }
104     
105     public void testWrapNonSerializable() {
106         DoubleList list = ListDoubleList.wrap(new AbstractList JavaDoc() {
107             public Object JavaDoc get(int i) { throw new IndexOutOfBoundsException JavaDoc(); }
108             public int size() { return 0; }
109         });
110         assertNotNull(list);
111         assertTrue(!(list instanceof Serializable JavaDoc));
112     }
113
114 }
115
Popular Tags