1 16 package org.apache.commons.collections; 17 18 import junit.framework.Test; 19 20 import org.apache.commons.collections.buffer.PredicatedBuffer; 21 22 29 public class TestBufferUtils extends BulkTest { 30 31 public TestBufferUtils(String name) { 32 super(name); 33 } 34 35 36 public static Test suite() { 37 return BulkTest.makeSuite(TestBufferUtils.class); 38 } 39 40 public void testNothing() { 41 } 42 43 public void testpredicatedBuffer() { 44 Predicate predicate = new Predicate() { 45 public boolean evaluate(Object o) { 46 return o instanceof String ; 47 } 48 }; 49 Buffer buffer = BufferUtils.predicatedBuffer(new ArrayStack(), predicate); 50 assertTrue("returned object should be a PredicatedBuffer", 51 buffer instanceof PredicatedBuffer); 52 try { 53 buffer = BufferUtils.predicatedBuffer(new ArrayStack(), null); 54 fail("Expecting IllegalArgumentException for null predicate."); 55 } catch (IllegalArgumentException ex) { 56 } 58 try { 59 buffer = BufferUtils.predicatedBuffer(null, predicate); 60 fail("Expecting IllegalArgumentException for null buffer."); 61 } catch (IllegalArgumentException ex) { 62 } 64 } 65 66 } 67 | Popular Tags |