### Question:
Constant implements NullaryFunction<T>, Function<Object, T>, BinaryFunction<Object, Object, T>,
        NullaryPredicate, Predicate<Object>, BinaryPredicate<Object, Object> { public boolean test() { return ((Boolean) evaluate()).booleanValue(); } Constant(T value); T evaluate(); T evaluate(Object obj); T evaluate(Object left, Object right); boolean test(); boolean test(Object obj); boolean test(Object left, Object right); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static Constant<Boolean> truePredicate(); static Constant<Boolean> falsePredicate(); static Constant<Boolean> predicate(boolean value); static Constant<T> of(T value); static final Constant<Boolean> TRUE; static final Constant<Boolean> FALSE; }### Answer:
@Test public void testConstantTrue() throws Exception { Constant<Object> truePred = new Constant<Object>(Boolean.TRUE); assertTrue(truePred.test()); assertTrue(truePred.test(null)); assertTrue(truePred.test(null, null)); assertTrue(truePred.test()); assertTrue(truePred.test("foo")); assertTrue(truePred.test("foo", Integer.valueOf(2))); }
@Test public void testConstantFalse() throws Exception { Constant<Object> falsePred = new Constant<Object>(Boolean.FALSE); assertTrue(!falsePred.test()); assertTrue(!falsePred.test(null)); assertTrue(!falsePred.test(null, null)); assertTrue(!falsePred.test()); assertTrue(!falsePred.test("foo")); assertTrue(!falsePred.test("foo", Integer.valueOf(2))); }