@Test(dataProvider = "valueEncodingProvider") public void testURLEncodeOnValue(final String inputValue, final String expectedQueryParam) throws Exception { Query<String> query = new Query<>("", inputValue); Assert.assertEquals(query.toQueryParam(), "by=" + expectedQueryParam); }
public String toQueryParam() { String translatedValue = value.toString(); try { translatedValue = URLEncoder.encode(translatedValue, StandardCharsets.UTF_8.name()); } catch(UnsupportedEncodingException e) { logger.error(String.format("%1$s encoding is not supported. The world is ending.", StandardCharsets.UTF_8.name()), e); } return BY_PREFIX + field.name() + "=" + translatedValue; }
Query { public String toQueryParam() { String translatedValue = value.toString(); try { translatedValue = URLEncoder.encode(translatedValue, StandardCharsets.UTF_8.name()); } catch(UnsupportedEncodingException e) { logger.error(String.format("%1$s encoding is not supported. The world is ending.", StandardCharsets.UTF_8.name()), e); } return BY_PREFIX + field.name() + "=" + translatedValue; } }
Query { public String toQueryParam() { String translatedValue = value.toString(); try { translatedValue = URLEncoder.encode(translatedValue, StandardCharsets.UTF_8.name()); } catch(UnsupportedEncodingException e) { logger.error(String.format("%1$s encoding is not supported. The world is ending.", StandardCharsets.UTF_8.name()), e); } return BY_PREFIX + field.name() + "=" + translatedValue; } Query();  Query(String field, T value);  Query(DataField field, T value);  Query(DataField field, T value, boolean isCollection); }
Query { public String toQueryParam() { String translatedValue = value.toString(); try { translatedValue = URLEncoder.encode(translatedValue, StandardCharsets.UTF_8.name()); } catch(UnsupportedEncodingException e) { logger.error(String.format("%1$s encoding is not supported. The world is ending.", StandardCharsets.UTF_8.name()), e); } return BY_PREFIX + field.name() + "=" + translatedValue; } Query();  Query(String field, T value);  Query(DataField field, T value);  Query(DataField field, T value, boolean isCollection); DataField getField(); void setField(DataField field); void setValue(T value); boolean isCollection(); void setCollection(boolean collection); String toQueryParam(); T getValue(); Integer getIntValue(); Boolean getBooleanValue(); String getStringValue(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
Query { public String toQueryParam() { String translatedValue = value.toString(); try { translatedValue = URLEncoder.encode(translatedValue, StandardCharsets.UTF_8.name()); } catch(UnsupportedEncodingException e) { logger.error(String.format("%1$s encoding is not supported. The world is ending.", StandardCharsets.UTF_8.name()), e); } return BY_PREFIX + field.name() + "=" + translatedValue; } Query();  Query(String field, T value);  Query(DataField field, T value);  Query(DataField field, T value, boolean isCollection); DataField getField(); void setField(DataField field); void setValue(T value); boolean isCollection(); void setCollection(boolean collection); String toQueryParam(); T getValue(); Integer getIntValue(); Boolean getBooleanValue(); String getStringValue(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }