FileDocCategorySizeDatePackage
PredicatesTest.javaAPI DocAndroid 1.5 API2682Wed May 06 22:42:02 BST 2009com.android.internal.util

PredicatesTest

public class PredicatesTest extends TestCase

Fields Summary
private static final Predicate
TRUE
private static final Predicate
FALSE
Constructors Summary
Methods Summary
private static java.util.ArrayListnewArrayList(E elements)

        ArrayList<E> list = new ArrayList<E>();
        Collections.addAll(list, elements);
        return list;
    
public voidtestAndPredicate_AllConditionsTrue()


         
        assertTrue(Predicates.and(newArrayList(TRUE)).apply(null));
        assertTrue(Predicates.and(newArrayList(TRUE, TRUE)).apply(null));
    
public voidtestAndPredicate_AtLeastOneConditionIsFalse()

        assertFalse(Predicates.and(newArrayList(FALSE, TRUE, TRUE)).apply(null));
        assertFalse(Predicates.and(newArrayList(TRUE, FALSE, TRUE)).apply(null));
        assertFalse(Predicates.and(newArrayList(TRUE, TRUE, FALSE)).apply(null));
    
public voidtestNotPredicate()

        assertTrue(Predicates.not(FALSE).apply(null));
        assertFalse(Predicates.not(TRUE).apply(null));
    
public voidtestOrPredicate_AllConditionsFalse()

        assertFalse(Predicates.or(newArrayList(FALSE, FALSE, FALSE)).apply(null));
    
public voidtestOrPredicate_AllConditionsTrue()

        assertTrue(Predicates.or(newArrayList(TRUE, TRUE, TRUE)).apply(null));
    
public voidtestOrPredicate_AtLeastOneConditionIsTrue()

        assertTrue(Predicates.or(newArrayList(TRUE, FALSE, FALSE)).apply(null));
        assertTrue(Predicates.or(newArrayList(FALSE, TRUE, FALSE)).apply(null));
        assertTrue(Predicates.or(newArrayList(FALSE, FALSE, TRUE)).apply(null));