### Question:
DefaultUpgradeService implements UpgradeService { List<Resource> getAdditionalDatamapResources(UpgradeUnit upgradeUnit) { List<Resource> resources = new ArrayList<>(); try { XPath xpath = XPathFactory.newInstance().newXPath(); NodeList nodes = (NodeList) xpath.evaluate("/domain/map/@name", upgradeUnit.getDocument(), XPathConstants.NODESET); for (int i = 0; i < nodes.getLength(); i++) { Node mapNode = nodes.item(i); Resource mapResource = upgradeUnit.getResource().getRelativeResource(mapNode.getNodeValue() + ".map.xml"); resources.add(mapResource); } } catch (Exception ex) { logger.warn("Can't get additional dataMap resources: ", ex); } return resources; } DefaultUpgradeService(@Inject List<UpgradeHandler> handlerList); @Override UpgradeMetaData getUpgradeType(Resource resource); @Override Resource upgradeProject(Resource resource); static final String UNKNOWN_VERSION; static final String MIN_SUPPORTED_VERSION; }### Answer:
@Test public void getAdditionalDatamapResources() throws Exception { URL url = getClass().getResource("../cayenne-PROJECT1.xml"); Resource resource = new URLResource(url); Document document = readDocument(url); UpgradeUnit unit = new UpgradeUnit(resource, document); List<Resource> resources = upgradeService.getAdditionalDatamapResources(unit); assertEquals(2, resources.size()); assertTrue(resources.get(0).getURL().sameFile(getClass().getResource("../testProjectMap1_1.map.xml"))); }