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