FilterTemplate { public String format() { String s = searchFilter; if (!parameters.isEmpty()) { for (Map.Entry<String, Object> e : parameters.entrySet()) { final String encoded = encode(e.getValue()); if (encoded != null) { s = s.replace("{" + e.getKey() + "}", encoded); } } } return s; } FilterTemplate();  FilterTemplate(final String filter);  FilterTemplate(final String filter, final Object[] params); String getFilter(); void setFilter(final String filter); Map<String, Object> getParameters(); void setParameter(final int position, final Object value); void setParameter(final String name, final Object value); void setParameters(final Object[] values); String format(); static String encodeValue(final byte[] value); static String encodeValue(final String value); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static Builder builder();  }
@Test(groups = "filter", dataProvider = "filters") public void testFormat(final String encodedFilter, final FilterTemplate filter) throws Exception { Assert.assertEquals(filter.format(), encodedFilter); }