@Test public void positionalParametersLikeAPICustomEscape() { String statement = "select doc.fullName from XWikiDocument doc where " + "doc.fullName like ? and doc.author like ? escape '!'"; Query query = mock(Query.class); when(query.getLanguage()).thenReturn(Query.HQL); when(query.getStatement()).thenReturn(statement); Map<Integer, Object> parameters = new LinkedHashMap<>(); parameters.put(0, new DefaultQueryParameter(null).literal("Foo!")); parameters.put(1, new DefaultQueryParameter(null).like("Bar!").anychar()); when(query.getPositionalParameters()).thenReturn(parameters); Query filteredQuery = this.filter.filterQuery(query); String modifiedStatement = "SELECT doc.fullName FROM XWikiDocument doc WHERE " + "doc.fullName LIKE ? ESCAPE '!' AND doc.author LIKE ? ESCAPE '!'"; assertEquals(modifiedStatement, filteredQuery.getStatement()); assertTrue(filteredQuery.getNamedParameters().isEmpty()); Map<Integer, Object> expectedMap = new LinkedHashMap<>(); expectedMap.put(0, "Foo!!"); expectedMap.put(1, "Bar!!_"); assertEquals(expectedMap, filteredQuery.getPositionalParameters()); }
@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);  }