@Test public void attributeBetweenInclusive() { Predicate<Pair<Integer, ?>> predicate = Predicates.attributeBetweenInclusive(Functions.firstOfPair(), 9, 11); assertAccepts(predicate, Tuples.twin(9, 0), Tuples.twin(10, 0), Tuples.twin(11, 0)); assertRejects(predicate, Tuples.twin(8, 0), Tuples.twin(12, 0)); }
@Test public void attributeNotNull() { Twin<String> testCandidate = Tuples.twin("Hello", null); assertAccepts(Predicates.attributeNotNull(Functions.firstOfPair()), testCandidate); assertRejects(Predicates.attributeNotNull(Functions.secondOfPair()), testCandidate); assertToString(Predicates.attributeNotNull(Functions.<String>firstOfPair())); }
@Test public void attributeIsNullWithFunctionName() { Twin<Integer> target = Tuples.twin(null, 1); assertAccepts(Predicates.attributeIsNull(Functions.firstOfPair()), target); assertRejects(Predicates.attributeIsNull(Functions.secondOfPair()), target); }
@Test public void ifFalseWithClassAndFunctionName() { Twin<Boolean> target = Tuples.twin(true, false); assertRejects(Predicates.ifFalse(Functions.firstOfPair()), target); assertAccepts(Predicates.ifFalse(Functions.secondOfPair()), target); }