StringValuePredicate implements ValuePredicate<Object> { @Override public boolean apply(@Nullable Object input) { return Objects.equal(value, input); } StringValuePredicate(@Nullable String value); @Override boolean apply(@Nullable Object input); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testValueComparison() throws Exception { Object[][] inputs = { {"abc", "abc", true}, {"", "", true}, {"AB", "A", false}, {null, null, true}, {null, "", false}, {"", null, false} }; for(Object[] input : inputs){ String value = (String)input[0]; String inputValue = (String)input[1]; boolean expected = ((Boolean)input[2]).booleanValue(); StringValuePredicate pred = new StringValuePredicate(value); assertEquals(String.format("Given value = %s, and input = %s", value, inputValue), expected, pred.apply(inputValue)); } }