void (String url, String testFile, String expectedFile, boolean matchStart) { class JavadocExternalTestFilter extends JavaDocExternalFilter { JavadocExternalTestFilter(Project project) { super(project); } public void test(String url, Reader input, StringBuilder data, boolean matchStart) { try { super.doBuildFromStream(url, input, data, false, matchStart); } catch (IOException e) { throw new RuntimeException(e); } } } String text = loadFile(testFile); JavadocExternalTestFilter filter = new JavadocExternalTestFilter(getProject()); StringBuilder extractedData = new StringBuilder(); filter.test(url, new StringReader(text), extractedData, true); if (!matchStart) { assertEmpty(extractedData.toString()); filter.test(url, new StringReader(text), extractedData, false); } assertEquals(loadFile(expectedFile), extractedData.toString()); }