XMLParser { public NodeList getAllNodesInScope() throws XPathExpressionException { String nodeLocator = " XPathExpression expression = xpath.compile(nodeLocator); return (NodeList) expression.evaluate(repositoryMap, XPathConstants.NODESET); } XMLParser(InputStream repositoryMap, Set<OperatingSystem> operatingSystems, Map<String, String> driverVersions, boolean thirtyTwoBit, boolean sixtyFourBit); NodeList getAllNodesInScope();  }
@Test public void listWithAllNodesReturnedWhenPassingInARepositoryMap() throws XPathExpressionException { InputStream xmlRepositoryMap = this.getClass().getResourceAsStream("/TestRepoMap.xml"); XMLParser parser = new XMLParser(xmlRepositoryMap, new HashSet<OperatingSystem>(), new HashMap<String, String>(), false, false); NodeList nodes = parser.getAllNodesInScope(); assertThat(nodes.getLength(), is(equalTo(12))); }
@Test public void returnsSpecificNodeLocatorWhenOptionsAreSpecified() throws XPathExpressionException { Set<OperatingSystem> one = new HashSet<OperatingSystem>(); one.add(WINDOWS); Map<String, String> versionsToFind = new HashMap<String, String>(); versionsToFind.put("googlechrome", "22"); InputStream xmlRepositoryMap = this.getClass().getResourceAsStream("/TestRepoMap.xml"); XMLParser parser = new XMLParser(xmlRepositoryMap, one, versionsToFind, true, true); NodeList nodes = parser.getAllNodesInScope(); assertThat(nodes.getLength(), is(equalTo(1))); }