/**
* Download the resource at the given URI and make sure its contents are
* identical to a merged list of files from the test fixture.
*/
private void assertDownloaded(WicketTester tester, String uri, ResourceSpec... specs) throws IOException {
StringList expected = new StringList();
for (ResourceSpec spec : specs) {
InputStream is = spec.getScope().getResourceAsStream(spec.getFile());
try {
expected.add(IOUtils.toString(is, "UTF-8"));
} finally {
IOUtils.closeQuietly(is);
}
}
WebRequestCycle wrc = tester.setupRequestAndResponse(false);
tester.getServletRequest().setURL(uri);
tester.processRequestCycle(wrc);
// Note: merging adds two newlines between each merged file
assertEquals(expected.join("\n\n"), tester.getServletResponse().getDocument());
}