UriQueryParser { public String getValueOrDefault(String key, String defValue) { List<String> strings = parameters.get(key); if (strings == null || strings.isEmpty()) { return defValue; } return strings.get(0); } UriQueryParser(String url);  UriQueryParser(String url, Charset charset); List<String> getValue(String key); String getValueOrDefault(String key, String defValue); boolean hasKey(String key); List<Param> params();  }
@Test public void getDefaultValue() throws Exception { assertEquals("value1", uriQueryParser.getValueOrDefault("param1", "missingValue")); assertEquals("missingValue", uriQueryParser.getValueOrDefault("param4", "missingValue")); }