use of org.apache.tapestry5.ioc.internal.util.AbstractResource in project tapestry-5 by apache.
the class TemplateParserImplTest method resource_that_throws_exception.
@Test
public // TAP5-2516
void resource_that_throws_exception() throws Exception {
Resource resource = new AbstractResource("throwfoo") {
@Override
public URL toURL() {
return null;
}
@Override
public boolean exists() {
return true;
}
@Override
protected Resource newResource(String path) {
return null;
}
@Override
public InputStream openStream() throws IOException {
throw new IOException("foo");
}
};
try {
getParser().parseTemplate(resource);
unreachable();
} catch (RuntimeException ex) {
if (ex.getCause() instanceof TapestryException && ex.getCause().getCause() instanceof IOException) {
assertMessageContains(ex, "foo");
} else {
throw ex;
}
}
}
Aggregations