1 17 package org.apache.commons.collections.primitives; 18 19 import java.util.Collections ; 20 21 import junit.framework.Test; 22 import junit.framework.TestCase; 23 import junit.framework.TestSuite; 24 25 import org.apache.commons.collections.primitives.adapters.IteratorShortIterator; 26 27 31 public class TestAbstractShortCollection extends TestCase { 32 33 36 public TestAbstractShortCollection(String testName) { 37 super(testName); 38 } 39 40 public static Test suite() { 41 return new TestSuite(TestAbstractShortCollection.class); 42 } 43 44 47 public void testAddIsUnsupportedByDefault() { 48 ShortCollection col = new ShortCollectionImpl(); 49 try { 50 col.add((short)1); 51 fail("Expected UnsupportedOperationException"); 52 } catch(UnsupportedOperationException e) { 53 } 55 } 56 59 60 static class ShortCollectionImpl extends AbstractShortCollection { 61 public ShortCollectionImpl() { 62 } 63 64 public ShortIterator iterator() { 65 return new IteratorShortIterator(Collections.EMPTY_LIST.iterator()); 66 } 67 68 public int size() { 69 return 0; 70 } 71 } 72 } 73 | Popular Tags |