public void testFalsePredicate() { assertNotNull(PredicateUtils.falsePredicate()); assertSame(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()); assertEquals(false, PredicateUtils.falsePredicate().evaluate(null)); assertEquals(false, PredicateUtils.falsePredicate().evaluate(cObject)); assertEquals(false, PredicateUtils.falsePredicate().evaluate(cString)); assertEquals(false, PredicateUtils.falsePredicate().evaluate(cInteger)); }
public void testOrPredicate() { assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.orPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); }
public void testAndPredicate() { assertEquals(true, PredicateUtils.andPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); }
public void testEitherPredicate() { assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); }
public void testNeitherPredicate() { assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); assertEquals(true, PredicateUtils.neitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); }
PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.allPredicate(new Predicate[] { PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.allPredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.allPredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); Collection coll = new ArrayList(); coll.add(PredicateUtils.truePredicate()); coll.clear(); coll.add(PredicateUtils.truePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); assertFalse(PredicateUtils.allPredicate(coll).evaluate(null)); coll.clear();
PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.nonePredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); Collection coll = new ArrayList(); coll.add(PredicateUtils.truePredicate()); coll.clear(); coll.add(PredicateUtils.truePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); assertEquals(true, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); assertTrue(PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear();
PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] { PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.anyPredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); Collection coll = new ArrayList(); coll.add(PredicateUtils.truePredicate()); coll.clear(); coll.add(PredicateUtils.truePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); assertEquals(false, PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); assertFalse(PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear();
PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.onePredicate(new Predicate[] { PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.onePredicate(new Predicate[] { PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.onePredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.onePredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.onePredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); Collection coll = new ArrayList(); coll.add(PredicateUtils.truePredicate()); coll.clear(); coll.add(PredicateUtils.truePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(true, PredicateUtils.onePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null));
public void testNullIsFalsePredicate() { assertEquals(false, PredicateUtils.nullIsFalsePredicate(PredicateUtils.truePredicate()).evaluate(null)); assertEquals(true, PredicateUtils.nullIsFalsePredicate(PredicateUtils.truePredicate()).evaluate(new Object())); assertEquals(false, PredicateUtils.nullIsFalsePredicate(PredicateUtils.falsePredicate()).evaluate(new Object())); }
public void testNullIsTruePredicate() { assertEquals(true, PredicateUtils.nullIsTruePredicate(PredicateUtils.truePredicate()).evaluate(null)); assertEquals(true, PredicateUtils.nullIsTruePredicate(PredicateUtils.truePredicate()).evaluate(new Object())); assertEquals(false, PredicateUtils.nullIsTruePredicate(PredicateUtils.falsePredicate()).evaluate(new Object())); }
public void testWhileClosure() { MockClosure cmd = new MockClosure(); ClosureUtils.whileClosure(PredicateUtils.falsePredicate(), cmd).execute(null); assertEquals(0, cmd.count); cmd = new MockClosure(); ClosureUtils.whileClosure(PredicateUtils.uniquePredicate(), cmd).execute(null); assertEquals(1, cmd.count); try { ClosureUtils.whileClosure(null, ClosureUtils.nopClosure()); fail(); } catch (IllegalArgumentException ex) {} try { ClosureUtils.whileClosure(PredicateUtils.falsePredicate(), null); fail(); } catch (IllegalArgumentException ex) {} try { ClosureUtils.whileClosure(null, null); fail(); } catch (IllegalArgumentException ex) {} }
public void testDoWhileClosure() { MockClosure cmd = new MockClosure(); ClosureUtils.doWhileClosure(cmd, PredicateUtils.falsePredicate()).execute(null); assertEquals(1, cmd.count); cmd = new MockClosure(); ClosureUtils.doWhileClosure(cmd, PredicateUtils.uniquePredicate()).execute(null); assertEquals(2, cmd.count); try { ClosureUtils.doWhileClosure(null, null); fail(); } catch (IllegalArgumentException ex) {} }
public void testIfClosure() { MockClosure a = new MockClosure(); MockClosure b = null; ClosureUtils.ifClosure(PredicateUtils.truePredicate(), a).execute(null); assertEquals(1, a.count); a = new MockClosure(); ClosureUtils.ifClosure(PredicateUtils.falsePredicate(), a).execute(null); assertEquals(0, a.count); a = new MockClosure(); b = new MockClosure(); ClosureUtils.ifClosure(PredicateUtils.truePredicate(), a, b).execute(null); assertEquals(1, a.count); assertEquals(0, b.count); a = new MockClosure(); b = new MockClosure(); ClosureUtils.ifClosure(PredicateUtils.falsePredicate(), a, b).execute(null); assertEquals(0, a.count); assertEquals(1, b.count); }
assertEquals("B", TransformerUtils.switchTransformer(PredicateUtils.falsePredicate(), a, b).transform(null));
/** * An action that updates entity check boxes in response to the Select All state * change. */ public void checkAllAction() { Predicate predicate = view.getCheckAll().isSelected() ? PredicateUtils .truePredicate() : PredicateUtils.falsePredicate(); if (getParentController().updateSelection(predicate)) { tableBinding.updateView(); } } }
public void generatorSelectedAction() { GeneratorController controller = generatorSelector.getGeneratorController(); validate(controller); Predicate predicate = controller != null ? controller.getDefaultClassFilter() : PredicateUtils.falsePredicate(); updateSelection(predicate); classesSelector.classSelectedAction(); }