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.IteratorByteIterator; 26 27 31 public class TestAbstractByteCollection extends TestCase { 32 33 36 public TestAbstractByteCollection(String testName) { 37 super(testName); 38 } 39 40 public static Test suite() { 41 return new TestSuite(TestAbstractByteCollection.class); 42 } 43 44 47 public void testAddIsUnsupportedByDefault() { 48 ByteCollection col = new ByteCollectionImpl(); 49 try { 50 col.add((byte)1); 51 fail("Expected UnsupportedOperationException"); 52 } catch(UnsupportedOperationException e) { 53 } 55 } 56 59 60 static class ByteCollectionImpl extends AbstractByteCollection { 61 public ByteCollectionImpl() { 62 } 63 64 public ByteIterator iterator() { 65 return new IteratorByteIterator(Collections.EMPTY_LIST.iterator()); 66 } 67 68 public int size() { 69 return 0; 70 } 71 } 72 } | Popular Tags |