### Question:
CreateNestedTransformationRule implements SchemaTransformationRule { @Override public Map<String, Object> transform(Map<String, Object> event) { return transform(event, key); } CreateNestedTransformationRule(List<String> key); @Override Map<String, Object> transform(Map<String, Object> event);  }### Answer:
@Test public void transformSimple() { Map<String, Object> event = new HashMap<>(); List<String> key = new ArrayList<>(); key.add("key"); CreateNestedTransformationRule createNested = new CreateNestedTransformationRule(key); Map<String, Object> result = createNested.transform(event); assertEquals(1, result.keySet().size()); assertEquals(0, ((Map<String, Object>) result.get("key")).keySet().size()); }
@Test public void transformNested() { Map<String, Object> event = new HashMap<>(); event.put("parent", new HashMap<>()); List<String> key = new ArrayList<>(); key.add("parent"); key.add("child"); CreateNestedTransformationRule createNested = new CreateNestedTransformationRule(key); Map<String, Object> result = createNested.transform(event); assertEquals(1, result.keySet().size()); assertEquals(1, ((Map<String, Object>) result.get("parent")).keySet().size()); assertEquals(0, (((Map<String, Object>) ((Map<String, Object>) result.get("parent")).get("child")).keySet().size())); }