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