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;
20 import java.util.List;
21
22 import junit.framework.Test;
23 import junit.framework.TestSuite;
24
25 import org.apache.commons.collections.BulkTest;
26 import org.apache.commons.collections.primitives.ArrayLongList;
27 import org.apache.commons.collections.primitives.RandomAccessLongList;
28
29 /**
30 * @version $Revision: 480451 $ $Date: 2006-11-29 02:45:08 -0500 (Wed, 29 Nov 2006) $
31 * @author Rodney Waldhoff
32 */
33 public class TestLongListList extends BaseTestList {
34
35 // conventional
36 // ------------------------------------------------------------------------
37
38 public TestLongListList(String testName) {
39 super(testName);
40 }
41
42 public static Test suite() {
43 TestSuite suite = BulkTest.makeSuite(TestLongListList.class);
44 return suite;
45 }
46
47 // collections testing framework
48 // ------------------------------------------------------------------------
49
50 public List makeEmptyList() {
51 return new LongListList(new ArrayLongList());
52 }
53
54 public Object[] getFullElements() {
55 Long[] elts = new Long[10];
56 for(int i=0;i<elts.length;i++) {
57 elts[i] = new Long(i);
58 }
59 return elts;
60 }
61
62 public Object[] getOtherElements() {
63 Long[] elts = new Long[10];
64 for(int i=0;i<elts.length;i++) {
65 elts[i] = new Long(10 + i);
66 }
67 return elts;
68 }
69
70 // tests
71 // ------------------------------------------------------------------------
72
73 /** @TODO need to add serialized form to cvs */
74
75 public void testCanonicalEmptyCollectionExists() {
76 // XXX FIX ME XXX
77 // need to add a serialized form to cvs
78 }
79
80 public void testCanonicalFullCollectionExists() {
81 // XXX FIX ME XXX
82 // need to add a serialized form to cvs
83 }
84
85 public void testEmptyListCompatibility() {
86 // XXX FIX ME XXX
87 // need to add a serialized form to cvs
88 }
89
90 public void testFullListCompatibility() {
91 // XXX FIX ME XXX
92 // need to add a serialized form to cvs
93 }
94
95 public void testWrapNull() {
96 assertNull(LongListList.wrap(null));
97 }
98
99 public void testWrapSerializable() {
100 List list = LongListList.wrap(new ArrayLongList());
101 assertNotNull(list);
102 assertTrue(list instanceof Serializable);
103 }
104
105 public void testWrapNonSerializable() {
106 List list = LongListList.wrap(new RandomAccessLongList() {
107 public long get(int i) { throw new IndexOutOfBoundsException(); }
108 public int size() { return 0; }
109 });
110 assertNotNull(list);
111 assertTrue(!(list instanceof Serializable));
112 }
113 }