### Question:
Configuration { public Set<String> moveProperties(String sourceConfigType, String targetConfigType, Set<String> propertiesToMove) { Set<String> moved = new HashSet<>(); for (String property : propertiesToMove) { if (isPropertySet(sourceConfigType, property)) { String value = removeProperty(sourceConfigType, property); if (!isPropertySet(targetConfigType, property)) { setProperty(targetConfigType, property, value); } moved.add(property); } } return moved; } Configuration(Map<String, Map<String, String>> properties,
                       Map<String, Map<String, Map<String, String>>> attributes,
                       Configuration parentConfiguration);  Configuration(Map<String, Map<String, String>> properties,
                       Map<String, Map<String, Map<String, String>>> attributes); Map<String, Map<String, String>> getProperties(); Map<String, Map<String, String>> getFullProperties(); Map<String, Map<String, String>> getFullProperties(int depthLimit); Map<String, Map<String, Map<String, String>>> getAttributes(); Map<String, Map<String, Map<String, String>>> getFullAttributes(); String getPropertyValue(String configType, String propertyName); String getAttributeValue(String configType, String propertyName, String attributeName); String setProperty(String configType, String propertyName, String value); String removeProperty(String configType, String propertyName); Set<String> moveProperties(String sourceConfigType, String targetConfigType, Set<String> propertiesToMove); boolean isPropertySet(String configType, String propertyName); String setAttribute(String configType, String propertyName, String attributeName, String attributeValue); Collection<String> getAllConfigTypes(); Configuration getParentConfiguration(); void setParentConfiguration(Configuration parent); void removeConfigType(String configType);  }### Answer:
@Test public void moveProperties() { String sourceType = "source"; String targetType = "target"; String sourceValue = "source value"; String targetValue = "target value"; Map<String, String> keepers = ImmutableMap.of("keep1", "v1", "keep2", "v3"); Map<String, String> movers = ImmutableMap.of("move1", "v2", "move2", "v4"); Set<String> common = ImmutableSet.of("common1", "common2"); Configuration config = new Configuration(new HashMap<>(), new HashMap<>()); for (Map.Entry<String, String> e : keepers.entrySet()) { config.setProperty(sourceType, e.getKey(), e.getValue()); } for (Map.Entry<String, String> e : movers.entrySet()) { config.setProperty(sourceType, e.getKey(), e.getValue()); } for (String key : common) { config.setProperty(sourceType, key, sourceValue); config.setProperty(targetType, key, targetValue); } Sets.SetView<String> propertiesToMove = Sets.union(movers.keySet(), common); Set<String> moved = config.moveProperties(sourceType, targetType, propertiesToMove); for (Map.Entry<String, String> e : keepers.entrySet()) { assertEquals(e.getValue(), config.getPropertyValue(sourceType, e.getKey())); } for (Map.Entry<String, String> e : movers.entrySet()) { assertEquals(e.getValue(), config.getPropertyValue(targetType, e.getKey())); assertFalse(config.isPropertySet(sourceType, e.getKey())); } for (String key : common) { assertEquals(targetValue, config.getPropertyValue(targetType, key)); assertFalse(config.isPropertySet(sourceType, key)); } assertEquals(propertiesToMove, moved); }