@Test(groups = "unit") public void composeSimpleObjectsWithLongerPaths() throws Exception { Map<Path,Object> simpleObjects = new HashMap<Path,Object>(); simpleObjects.put(DefaultPath.fromEncodedPathString("a%2F%40%23/b/c"), ""); simpleObjects.put(DefaultPath.fromEncodedPathString("a%2F%40%23/b/d"), 42); simpleObjects.put(DefaultPath.fromEncodedPathString("d/e/f"), true); simpleObjects.put(DefaultPath.fromEncodedPathString("d/f/g"), false); simpleObjects.put(DefaultPath.fromEncodedPathString("j/k/l"), null); Object result = composer.compose(simpleObjects); Map<String,Object> expectedResult = getExpectedMapForComposeSimpleObjectWithLongerPaths(); assertEquals(result, expectedResult); }
public Object compose(Map<Path,Object> simpleObjects) { if (simpleObjects == null) { throw new IllegalArgumentException("simpleObject is null"); } if (simpleObjects.isEmpty()) { return Collections.emptyMap(); } if (simpleObjects.size() == 1 && simpleObjects.keySet().iterator().next().size() == 0) { return simpleObjects.values().iterator().next(); } return transformLists(composeMap(simpleObjects)); }
Composer { public Object compose(Map<Path,Object> simpleObjects) { if (simpleObjects == null) { throw new IllegalArgumentException("simpleObject is null"); } if (simpleObjects.isEmpty()) { return Collections.emptyMap(); } if (simpleObjects.size() == 1 && simpleObjects.keySet().iterator().next().size() == 0) { return simpleObjects.values().iterator().next(); } return transformLists(composeMap(simpleObjects)); } }
Composer { public Object compose(Map<Path,Object> simpleObjects) { if (simpleObjects == null) { throw new IllegalArgumentException("simpleObject is null"); } if (simpleObjects.isEmpty()) { return Collections.emptyMap(); } if (simpleObjects.size() == 1 && simpleObjects.keySet().iterator().next().size() == 0) { return simpleObjects.values().iterator().next(); } return transformLists(composeMap(simpleObjects)); } private  Composer(); }
Composer { public Object compose(Map<Path,Object> simpleObjects) { if (simpleObjects == null) { throw new IllegalArgumentException("simpleObject is null"); } if (simpleObjects.isEmpty()) { return Collections.emptyMap(); } if (simpleObjects.size() == 1 && simpleObjects.keySet().iterator().next().size() == 0) { return simpleObjects.values().iterator().next(); } return transformLists(composeMap(simpleObjects)); } private  Composer(); static Composer get(); Object compose(Map<Path,Object> simpleObjects); }
Composer { public Object compose(Map<Path,Object> simpleObjects) { if (simpleObjects == null) { throw new IllegalArgumentException("simpleObject is null"); } if (simpleObjects.isEmpty()) { return Collections.emptyMap(); } if (simpleObjects.size() == 1 && simpleObjects.keySet().iterator().next().size() == 0) { return simpleObjects.values().iterator().next(); } return transformLists(composeMap(simpleObjects)); } private  Composer(); static Composer get(); Object compose(Map<Path,Object> simpleObjects);  }