### Question:
GuavaHelpers { public static <T> com.google.common.base.Predicate<T> wrap(Predicate predicate) { Path<?> path = predicate.accept(PathExtractor.DEFAULT, null); if (path != null) { final Evaluator<Boolean> ev = createEvaluator(path.getRoot(), predicate); return new com.google.common.base.Predicate<T>() { @Override public boolean apply(T input) { return ev.evaluate(input); } }; } else { throw new IllegalArgumentException("No path in " + predicate); } } private  GuavaHelpers(); static com.google.common.base.Predicate<T> wrap(Predicate predicate); static Function<F,T> wrap(Expression<T> projection);  }### Answer:
@Test public void predicate() { Predicate<Cat> predicate = GuavaHelpers.wrap(QCat.cat.name.startsWith("Ann")); assertTrue(predicate.apply(new Cat("Ann"))); assertFalse(predicate.apply(new Cat("Bob"))); }
@Test public void function() { Function<Cat, String> function = GuavaHelpers.wrap(QCat.cat.name); assertEquals("Ann", function.apply(new Cat("Ann"))); assertEquals("Bob", function.apply(new Cat("Bob"))); }