1 16 package org.apache.commons.collections.buffer; 17 18 import java.util.Arrays ; 19 import java.util.Collection ; 20 21 import junit.framework.Test; 22 import junit.framework.TestSuite; 23 24 import org.apache.commons.collections.ArrayStack; 25 import org.apache.commons.collections.Buffer; 26 import org.apache.commons.collections.collection.AbstractTestCollection; 27 28 38 public class TestUnmodifiableBuffer extends AbstractTestCollection { 39 40 public TestUnmodifiableBuffer(String testName) { 41 super(testName); 42 } 43 44 public static Test suite() { 45 return new TestSuite(TestUnmodifiableBuffer.class); 46 } 47 48 public static void main(String args[]) { 49 String [] testCaseName = { TestUnmodifiableBuffer.class.getName()}; 50 junit.textui.TestRunner.main(testCaseName); 51 } 52 53 public Collection makeCollection() { 55 return UnmodifiableBuffer.decorate(new UnboundedFifoBuffer()); 56 } 57 58 public Collection makeFullCollection() { 59 Buffer buffer = new UnboundedFifoBuffer(); 60 buffer.addAll(Arrays.asList(getFullElements())); 61 return UnmodifiableBuffer.decorate(buffer); 62 } 63 64 public Collection makeConfirmedCollection() { 65 ArrayStack list = new ArrayStack(); 66 return list; 67 } 68 69 public Collection makeConfirmedFullCollection() { 70 ArrayStack list = new ArrayStack(); 71 list.addAll(Arrays.asList(getFullElements())); 72 return list; 73 } 74 75 public boolean isAddSupported() { 76 return false; 77 } 78 79 public boolean isRemoveSupported() { 80 return false; 81 } 82 83 public boolean isNullSupported() { 84 return false; 85 } 86 87 public void testBufferRemove() { 88 resetEmpty(); 89 Buffer buffer = (Buffer) collection; 90 try { 91 buffer.remove(); 92 fail(); 93 } catch (UnsupportedOperationException ex) {} 94 } 95 96 public String getCompatibilityVersion() { 97 return "3.1"; 98 } 99 100 107 } 108 | Popular Tags |