### Question:
ToolSpec { public boolean isValidInputStream(String id) { Element streams = getStreams(); if (streams == null) { return false; } List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(streams, Tool.TOOL_SPEC_PUBLIC_ID, "instream"); for (Element elem : elemList) { if (elem.getAttribute("id").equals(id)) { return true; } } return false; } ToolSpec();  ToolSpec(InputStream in);  ToolSpec(InputStream in, boolean validate);  ToolSpec(Document d); ExtendedDocumentBuilder getDocumentBuilder(); boolean isValidInputStream(String id); Element getElementById(String id); boolean hasHandler(); Tool getHandler(); Tool getHandler(ClassLoader loader); Element getStreams(); List<String> getInstreamIds(); List<String> getOutstreamIds(); Element getUsage(); void transform(InputStream stylesheet, OutputStream out); Element getPipeline(); List<Element> getUsageForms(); String getStreamRefName(String streamId); String getParameterDefault(String name); String getAnnotation();  }### Answer:
@Test public void testIsValidInputStream() throws Exception { String tsSource = "parser/resources/testtool1.xml"; toolSpec = new ToolSpec(getClass().getResourceAsStream(tsSource), false); assertTrue(toolSpec.isValidInputStream("testID")); assertFalse(toolSpec.isValidInputStream("dummyID")); assertTrue(toolSpec.getInstreamIds().size() == 1); }
@Test public void testIsValidInputStream() throws Exception { String tsSource = "parser/resources/testtool1.xml"; toolSpec = new ToolSpec(getClass().getResourceAsStream(tsSource), false); assertTrue(toolSpec.isValidInputStream("testID")); assertTrue(!toolSpec.isValidInputStream("dummyID")); assertTrue(toolSpec.getInstreamIds().size() == 1); }