collection.add("Item 2");
collection.add("Item 3");
collection.add("Item 4");
collection.add("Item 5");
IteratorTemplate template = new IteratorTemplate(collection.iterator());
assertTrue(template.allTrue(new Constraint() {
public boolean test(Object o) {
return ((String)o).startsWith("Item");
}
}));
try {
assertEquals(false, template.allTrue(new Constraint() {
public boolean test(Object o) {
return ((String)o).startsWith("Element");
}
}));
fail("Should have failed");