### Question:
PropertiesDecoder { public static Map<String,String> unflatten(final String s) { if(!ok(s)) return Collections.emptyMap(); Map<String,String> map = new HashMap<String,String>(); String[] elements = s.split(":"); for(String element : elements) { addPair(map, element); } return map; }  static Map<String,String> unflatten(final String s);  }### Answer:
@Test public void testUnflatten() { String s = "foo=goo:xyz:hoo=ioo"; Map<String, String> result = PropertiesDecoder.unflatten(s); Map<String, String> expResult = new HashMap<String,String>(); expResult.put("foo", "goo"); expResult.put("xyz", null); expResult.put("hoo", "ioo"); assertEquals(expResult, result); s = "foo=goo:xyz:hoo=ioo:qqq=::::z:"; result = PropertiesDecoder.unflatten(s); expResult.put("qqq", null); expResult.put("z", null); assertEquals(expResult, result); s = "foo=goo:xyz:hoo=ioo:qqq=::::z:foo=qbert:a=b=c=d"; result = PropertiesDecoder.unflatten(s); expResult.put("foo", "qbert"); expResult.put("a", "b=c=d"); assertEquals(expResult, result); }