1 17 package org.apache.commons.collections.primitives.adapters; 18 19 import java.io.Serializable ; 20 import java.util.Collection ; 21 22 import junit.framework.Test; 23 import junit.framework.TestSuite; 24 25 import org.apache.commons.collections.AbstractTestObject; 26 import org.apache.commons.collections.primitives.RandomAccessShortList; 27 import org.apache.commons.collections.primitives.ArrayShortList; 28 import org.apache.commons.collections.primitives.ShortList; 29 30 34 public class TestShortCollectionCollection extends AbstractTestObject { 35 36 39 public TestShortCollectionCollection(String testName) { 40 super(testName); 41 } 42 43 public static Test suite() { 44 return new TestSuite(TestShortCollectionCollection.class); 45 } 46 47 50 public Object makeObject() { 51 ShortList list = new ArrayShortList(); 52 for(int i=0;i<10;i++) { 53 list.add((short)i); 54 } 55 return new ShortCollectionCollection(list); 56 } 57 58 public void testSerializeDeserializeThenCompare() { 59 } 61 62 63 public void testCanonicalEmptyCollectionExists() { 64 } 67 68 public void testCanonicalFullCollectionExists() { 69 } 72 73 76 public void testWrapNull() { 77 assertNull(ShortCollectionCollection.wrap(null)); 78 } 79 80 public void testWrapSerializable() { 81 Collection collection = ShortCollectionCollection.wrap(new ArrayShortList()); 82 assertNotNull(collection); 83 assertTrue(collection instanceof Serializable ); 84 } 85 86 public void testWrapNonSerializable() { 87 Collection collection = ShortCollectionCollection.wrap(new RandomAccessShortList() { 88 public short get(int i) { throw new IndexOutOfBoundsException (); } 89 public int size() { return 0; } 90 }); 91 assertNotNull(collection); 92 assertTrue(!(collection instanceof Serializable )); 93 } 94 95 } 96 | Popular Tags |