001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.collections.primitives.adapters; 018 019import java.io.Serializable; 020import java.util.List; 021 022import junit.framework.Test; 023import junit.framework.TestSuite; 024 025import org.apache.commons.collections.BulkTest; 026import org.apache.commons.collections.primitives.ArrayLongList; 027import org.apache.commons.collections.primitives.RandomAccessLongList; 028 029/** 030 * @version $Revision: 480451 $ $Date: 2006-11-29 02:45:08 -0500 (Wed, 29 Nov 2006) $ 031 * @author Rodney Waldhoff 032 */ 033public class TestLongListList extends BaseTestList { 034 035 // conventional 036 // ------------------------------------------------------------------------ 037 038 public TestLongListList(String testName) { 039 super(testName); 040 } 041 042 public static Test suite() { 043 TestSuite suite = BulkTest.makeSuite(TestLongListList.class); 044 return suite; 045 } 046 047 // collections testing framework 048 // ------------------------------------------------------------------------ 049 050 public List makeEmptyList() { 051 return new LongListList(new ArrayLongList()); 052 } 053 054 public Object[] getFullElements() { 055 Long[] elts = new Long[10]; 056 for(int i=0;i<elts.length;i++) { 057 elts[i] = new Long(i); 058 } 059 return elts; 060 } 061 062 public Object[] getOtherElements() { 063 Long[] elts = new Long[10]; 064 for(int i=0;i<elts.length;i++) { 065 elts[i] = new Long(10 + i); 066 } 067 return elts; 068 } 069 070 // tests 071 // ------------------------------------------------------------------------ 072 073 /** @TODO need to add serialized form to cvs */ 074 075 public void testCanonicalEmptyCollectionExists() { 076 // XXX FIX ME XXX 077 // need to add a serialized form to cvs 078 } 079 080 public void testCanonicalFullCollectionExists() { 081 // XXX FIX ME XXX 082 // need to add a serialized form to cvs 083 } 084 085 public void testEmptyListCompatibility() { 086 // XXX FIX ME XXX 087 // need to add a serialized form to cvs 088 } 089 090 public void testFullListCompatibility() { 091 // XXX FIX ME XXX 092 // need to add a serialized form to cvs 093 } 094 095 public void testWrapNull() { 096 assertNull(LongListList.wrap(null)); 097 } 098 099 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}