### Question:
PercentEncoder { public String decode(String str) { try { return URLDecoder.decode(str, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException("Shall not happen", ex); } }  String encode(String str); String decode(String str);  }### Answer:
@Test public void testDecode() { Assert.assertEquals("query=world nomads&count=5", penc.decode("query%3Dworld%20nomads%26count%3D5")); Assert.assertEquals("query=He is \"Joe\"", penc.decode("query%3DHe%20is%20%22Joe%22")); Assert.assertEquals("pattern=a|b", penc.decode("pattern%3Da%7Cb")); }