### Question:
DomainJsonPathHelper { public static PresentationPath getPresentationPath(ClientDomain domain, String propertyPath){ final Matcher matcher = ROOT_PRESENTATION_ELEMENT_PATTERN.matcher(propertyPath); if(!matcher.find()){ throw new IllegalArgumentException("JSON Path " + propertyPath + " should start from schema.presentation[{dataIslandIndex}]. Where {dataIslandIndex} is a number"); } final List<PresentationGroupElement> presentation = domain.getSchema() != null && domain.getSchema().getPresentation() != null ? domain.getSchema().getPresentation() : new ArrayList<PresentationGroupElement>(); Integer dataIslandIndex = Integer.valueOf(matcher.group(1)); final PresentationGroupElement dataIsland = presentation.get(dataIslandIndex); return new PresentationPath(dataIsland.getName(), getElementsPath((List) dataIsland.getElements(), propertyPath)); }  static String getResourcePath(ClientDomain domain, String jsonPath); static PresentationPath getPresentationPath(ClientDomain domain, String propertyPath);  }### Answer:
@Test public void getHierarchicalPath(){ List<PresentationGroupElement> dataIslands = Arrays.asList( new PresentationGroupElement().setName("dataIsland1").setElements(Arrays.asList( (PresentationElement) new PresentationGroupElement().setName("set1"), new PresentationGroupElement().setName("set2").setElements(Arrays.asList( (PresentationElement) new PresentationSingleElement().setName("item2") )), new PresentationSingleElement().setName("item1"), new PresentationGroupElement().setName("set3") )), new PresentationGroupElement().setName("dataIsland2") ); final ClientDomain domain = new ClientDomain().setSchema(new Schema().setPresentation(dataIslands)); DomainJsonPathHelper.PresentationPath hierarchicalPath = DomainJsonPathHelper.getPresentationPath(domain, "schema.presentation[0]"); assertEquals("", hierarchicalPath.getHierarchicalName()); assertEquals("dataIsland1", hierarchicalPath.getDataIslandName()); hierarchicalPath = DomainJsonPathHelper.getPresentationPath(domain, "schema.presentation[0].elements[0]"); assertEquals("set1", hierarchicalPath.getHierarchicalName()); assertEquals("dataIsland1", hierarchicalPath.getDataIslandName()); hierarchicalPath = DomainJsonPathHelper.getPresentationPath(domain, "schema.presentation[0].elements[1]"); assertEquals("set2", hierarchicalPath.getHierarchicalName()); assertEquals("dataIsland1", hierarchicalPath.getDataIslandName()); hierarchicalPath = DomainJsonPathHelper.getPresentationPath(domain, "schema.presentation[0].elements[1].elements[0]"); assertEquals("set2.item2", hierarchicalPath.getHierarchicalName()); assertEquals("dataIsland1", hierarchicalPath.getDataIslandName()); hierarchicalPath = DomainJsonPathHelper.getPresentationPath(domain, "schema.presentation[0].elements[2]"); assertEquals("item1", hierarchicalPath.getHierarchicalName()); assertEquals("dataIsland1", hierarchicalPath.getDataIslandName()); hierarchicalPath = DomainJsonPathHelper.getPresentationPath(domain, "schema.presentation[0].elements[3]"); assertEquals("set3", hierarchicalPath.getHierarchicalName()); assertEquals("dataIsland1", hierarchicalPath.getDataIslandName()); hierarchicalPath = DomainJsonPathHelper.getPresentationPath(domain, "schema.presentation[1]"); assertEquals("", hierarchicalPath.getHierarchicalName()); assertEquals("dataIsland2", hierarchicalPath.getDataIslandName()); }