/**
* Base class for {@link BasicSupport}s testing.
+ * <p>
+ * It will use the paths:
+ * <ul>
+ * <li><tt>test/XXX/source</tt>: the html source files</li>
+ * <li><tt>test/XXX/expected</tt>: the expected output</li>
+ * <li><tt>test/XXX/actual</tt>: the actual output of the last test</li>
+ * </ul>
*
* @author niki
*/
addTest(support);
}
- static protected InputStream doOpen(Map<URL, File> map, URL url)
- throws IOException {
+ static protected InputStream doOpen(BasicSupport support,
+ Map<URL, File> map, URL url) throws IOException {
File file = map.get(url);
if (file == null) {
throw new FileNotFoundException("Test file not found for URL: "
+ url);
}
- return new FileInputStream(file);
+ return new FileInputStream("test/source/" + support.getType() + "/"
+ + file);
}
File expected = new File("test/expected/" + support.getType());
File actual = new File("test/result/" + support.getType());
+ IOUtils.deltree(actual);
+ expected.mkdirs();
+ actual.mkdirs();
+
Output gopher = new Gopher(support.getType(), "", "", 70);
Output html = new Html(support.getType(), "", "", 80);
for (Story story : support.list()) {
+ support.fetch(story);
IOUtils.writeSmallFile(new File(actual, story.getId()
+ ".header"), gopher.exportHeader(story));
IOUtils.writeSmallFile(