### Question:
TextQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { String constraint = getFilterableColumns(statement).stream() .map(column -> "lower(str(" + column + ")) like lower(:text)").collect(Collectors.joining(" or ")); if (constraint.isEmpty()) { return statement; } else { return insertWhereClause('(' + constraint + ')', statement, language); } }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results);  }### Answer:
@Test public void filterStatement() { String result = this.filter.filterStatement( "seLEct disTinCT user.alias as alias, user.name, user.age as unfilterable_age " + "fROm Users user where user.age >= 18", Query.HQL); assertEquals( "seLEct disTinCT user.alias as alias, user.name, user.age as unfilterable_age " + "fROm Users user " + "where (lower(str(user.alias)) like lower(:text) or lower(str(user.name)) like lower(:text))" + " and (user.age >= 18)", result); }
@Test public void filterStatementWithNoFilterableColumns() { String statement = "select age as unfilterable_age from Users"; assertEquals(statement, this.filter.filterStatement(statement, Query.HQL)); }