### Question:
DomainSchemaHelper { public static String getDataIslandPathFromElement(PresentationSingleElement element, List<ResourceElement> clientResources){ String result = null; if(element != null && element.getResourcePath() != null){ final String resourcePath = element.getResourcePath(); final String firstLevelResourcePath = resourcePath.substring(0, resourcePath.indexOf(".")); if(findResourceElement(firstLevelResourcePath, clientResources) instanceof JoinResourceGroupElement){ result = firstLevelResourcePath; } else { result = resourcePath.substring(0, resourcePath.lastIndexOf(".")); } } return result; }  static T findResourceElement(String resourcePath, List<ResourceElement> resources); static String getDataIslandPathFromElement(PresentationSingleElement element, List<ResourceElement> clientResources); static String getDataIslandPathFromGroup(PresentationGroupElement group, List<ResourceElement> clientResources,
            List<String> constantGroupNames);  }### Answer:
@Test public void getDataIslandPathFromElement_elementRefersJoinGroup_joinGroupPath() { final String joinGroupName = "someJoinGroup"; final ArrayList<ResourceElement> clientResources = new ArrayList<ResourceElement>() {{ add(new JoinResourceGroupElement().setName(joinGroupName)); }}; final PresentationSingleElement singleElement = new PresentationSingleElement() .setResourcePath(joinGroupName + ".some_table.some_column"); final String result = DomainSchemaHelper.getDataIslandPathFromElement(singleElement, clientResources); assertEquals(result, joinGroupName); }
@Test public void getDataIslandPathFromElement_elementRefersNonJoinedElement_substringOfResourcePath() { final String dataSourceGroupName = "dataSourceGroup"; final ArrayList<ResourceElement> clientResources = new ArrayList<ResourceElement>() {{ add(new ResourceGroupElement().setName(dataSourceGroupName)); }}; final String resourcePath = dataSourceGroupName + ".some_schema.some_table.some_column"; final PresentationSingleElement singleElement = new PresentationSingleElement() .setResourcePath(resourcePath); final String result = DomainSchemaHelper.getDataIslandPathFromElement(singleElement, clientResources); assertEquals(result, resourcePath.substring(0, resourcePath.lastIndexOf("."))); }