@Test(groups = {"unit"}, description = "tests the inconsistent root when the simple value comes first in iteration order") public void shouldComposeInconsistentRootOtherOrder() throws Exception { Map<Path,Object> map = ImmutableMap.<Path,Object>of(DefaultPath.fromEncodedPathString("a/"), "d", DefaultPath.fromEncodedPathString("a/b/"), "c"); Object result = composer.compose(map); Map<String,Object> expectedResult = ImmutableMap.<String,Object>of("a", ImmutableMap.of("b", "c", "@ROOT", "d")); 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);  }