@Test public void namedParametersLikeAPICustomEscape() { String statement = "select doc.fullName from XWikiDocument doc where " + "doc.fullName like :fullName escape '/' and doc.author like :author escape '!'"; Query query = mock(Query.class); when(query.getLanguage()).thenReturn(Query.HQL); when(query.getStatement()).thenReturn(statement); Map<String, Object> parameters = new LinkedHashMap<>(); parameters.put("fullName", new DefaultQueryParameter(null).literal("Foo parameters.put("author", new DefaultQueryParameter(null).like("Bar!").anychar()); when(query.getNamedParameters()).thenReturn(parameters); Query filteredQuery = this.filter.filterQuery(query); String modifiedStatement = "SELECT doc.fullName FROM XWikiDocument doc WHERE " + "doc.fullName LIKE :fullName ESCAPE '/' AND doc.author LIKE :author ESCAPE '!'"; assertEquals(modifiedStatement, filteredQuery.getStatement()); assertTrue(filteredQuery.getPositionalParameters().isEmpty()); Map<String, Object> expectedMap = new LinkedHashMap<>(); expectedMap.put("author", "Bar!!_"); expectedMap.put("fullName", "Foo assertEquals(expectedMap, filteredQuery.getNamedParameters()); }
@Override public Query filterQuery(Query query) { return new EscapeLikeParametersQuery(query); }
EscapeLikeParametersFilter implements QueryFilter { @Override public Query filterQuery(Query query) { return new EscapeLikeParametersQuery(query); } }
EscapeLikeParametersFilter implements QueryFilter { @Override public Query filterQuery(Query query) { return new EscapeLikeParametersQuery(query); }  }
EscapeLikeParametersFilter implements QueryFilter { @Override public Query filterQuery(Query query) { return new EscapeLikeParametersQuery(query); }  @Override Query filterQuery(Query query); @Override String filterStatement(String statement, String language); @Override List filterResults(List results); }
EscapeLikeParametersFilter implements QueryFilter { @Override public Query filterQuery(Query query) { return new EscapeLikeParametersQuery(query); }  @Override Query filterQuery(Query query); @Override String filterStatement(String statement, String language); @Override List filterResults(List results);  }