@Test public void shouldNotIncludeRestrictedValuesInStringRepresentation() throws UnsupportedEncodingException { PostData data = postData(); assertEquals("&sender=1982&text=hello+world",data.without("password","user")); }
public String without(String... values){ List<String> ignoreList = Arrays.asList(values); StringBuilder builder = new StringBuilder(); for(String key : data.keySet()){ if(! ignoreList.contains(key)){ builder.append("&").append(key).append("=").append(data.get(key)); } } return builder.toString(); }
PostData { public String without(String... values){ List<String> ignoreList = Arrays.asList(values); StringBuilder builder = new StringBuilder(); for(String key : data.keySet()){ if(! ignoreList.contains(key)){ builder.append("&").append(key).append("=").append(data.get(key)); } } return builder.toString(); } }
PostData { public String without(String... values){ List<String> ignoreList = Arrays.asList(values); StringBuilder builder = new StringBuilder(); for(String key : data.keySet()){ if(! ignoreList.contains(key)){ builder.append("&").append(key).append("=").append(data.get(key)); } } return builder.toString(); }  }
PostData { public String without(String... values){ List<String> ignoreList = Arrays.asList(values); StringBuilder builder = new StringBuilder(); for(String key : data.keySet()){ if(! ignoreList.contains(key)){ builder.append("&").append(key).append("=").append(data.get(key)); } } return builder.toString(); }  void add(String attribute, String value, String urlEncoding); void add(String attribute, String value); String toString(); String without(String... values); }
PostData { public String without(String... values){ List<String> ignoreList = Arrays.asList(values); StringBuilder builder = new StringBuilder(); for(String key : data.keySet()){ if(! ignoreList.contains(key)){ builder.append("&").append(key).append("=").append(data.get(key)); } } return builder.toString(); }  void add(String attribute, String value, String urlEncoding); void add(String attribute, String value); String toString(); String without(String... values);  }