Test the new countMatches method
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0ac46dd1c3
commit
92d67a604d
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Id: TestCollectionUtils.java,v 1.9 2002/11/24 21:12:30 scolebourne Exp $
|
||||
* $Revision: 1.9 $
|
||||
* $Date: 2002/11/24 21:12:30 $
|
||||
* $Id: TestCollectionUtils.java,v 1.10 2002/12/08 15:29:26 scolebourne Exp $
|
||||
* $Revision: 1.10 $
|
||||
* $Date: 2002/12/08 15:29:26 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -66,7 +66,7 @@ import java.util.*;
|
|||
|
||||
/**
|
||||
* @author Rodney Waldhoff
|
||||
* @version $Revision: 1.9 $ $Date: 2002/11/24 21:12:30 $
|
||||
* @version $Revision: 1.10 $ $Date: 2002/12/08 15:29:26 $
|
||||
*/
|
||||
public class TestCollectionUtils extends TestCase {
|
||||
public TestCollectionUtils(String testName) {
|
||||
|
@ -431,6 +431,21 @@ public class TestCollectionUtils extends TestCase {
|
|||
assertEquals("Two", list.get(0));
|
||||
}
|
||||
|
||||
public void testCountMatches() {
|
||||
List list = new ArrayList();
|
||||
list.add("One");
|
||||
list.add("Two");
|
||||
list.add("Three");
|
||||
list.add("Four");
|
||||
int count = CollectionUtils.countMatches(list, new Predicate() {
|
||||
public boolean evaluate(Object input) {
|
||||
return (input.equals("Two"));
|
||||
}
|
||||
});
|
||||
assertEquals(4, list.size());
|
||||
assertEquals(1, count);
|
||||
}
|
||||
|
||||
public void testSelect() {
|
||||
List list = new ArrayList();
|
||||
list.add("One");
|
||||
|
|
Loading…
Reference in New Issue