### Question:
PredicateUtils { static Predicate getStringLikeOrEqualPredicate( @NotNull final CriteriaBuilder cb, @NotNull final Expression<String> expression, @NotNull final String value ) { if (StringUtils.contains(value, PERCENT)) { return cb.like(expression, value); } else { return cb.equal(expression, value); } } private  PredicateUtils(); static String createTagSearchString(final Set<TagEntity> tags);  }### Answer:
@SuppressWarnings("unchecked") @Test void canGetStringLikeOrEqualPredicate() { final CriteriaBuilder cb = Mockito.mock(CriteriaBuilder.class); final Expression<String> expression = (Expression<String>) Mockito.mock(Expression.class); final Predicate likePredicate = Mockito.mock(Predicate.class); final Predicate equalPredicate = Mockito.mock(Predicate.class); Mockito.when(cb.like(Mockito.eq(expression), Mockito.anyString())).thenReturn(likePredicate); Mockito.when(cb.equal(Mockito.eq(expression), Mockito.anyString())).thenReturn(equalPredicate); Assertions .assertThat(PredicateUtils.getStringLikeOrEqualPredicate(cb, expression, "equal")) .isEqualTo(equalPredicate); Assertions .assertThat(PredicateUtils.getStringLikeOrEqualPredicate(cb, expression, "lik%e")) .isEqualTo(likePredicate); }