CriteriaMatcherInMemory { private boolean matchesLike(T infoObject, LikePredicate predicate) { Object dataValue = extractValue(predicate.getPropertyPath(), infoObject); return matchesLike(dataValue, predicate.getValue().getValue()); } CriteriaMatcherInMemory(); QueryByCriteria getCriteria(); void setCriteria(QueryByCriteria criteria); Collection<T> findMatching(Collection<T> all); boolean matches(T infoObject); static boolean matchesEqual(Object dataValue, Object criteriaValue); static boolean matchesLessThan(Object dataValue, Object criteriaValue); static boolean matchesGreaterThan(Object dataValue, Object criteriaValue); boolean matchesLike(Object dataValue, Object criteriaValue); boolean matchesLikeCachingPattern(final String str, final String expr); static boolean matchesLike(final String str, final String expr);  }
@Test public void testMatchesLike() { assertEquals(true, CriteriaMatcherInMemory.matchesLike("a", "a")); assertEquals(false, CriteriaMatcherInMemory.matchesLike("a", "b")); assertEquals(false, CriteriaMatcherInMemory.matchesLike("b", "a")); assertEquals(true, CriteriaMatcherInMemory.matchesLike("b", "%")); assertEquals(true, CriteriaMatcherInMemory.matchesLike("b", "b%")); assertEquals(false, CriteriaMatcherInMemory.matchesLike("b", "a%")); assertEquals(true, CriteriaMatcherInMemory.matchesLike("bbbbba", "%a%")); }