@Test(expected = PreparerException.class) public void testExecuteException() throws IOException { DispatchRequest requestContext = createMock(DispatchRequest.class); AttributeContext attributeContext = createMock(AttributeContext.class); requestContext.include("/my/url.do"); expectLastCall().andThrow(new IOException()); replay(requestContext, attributeContext); try { preparer.execute(requestContext, attributeContext); } finally { verify(requestContext, attributeContext); } }
@Override public void execute(Request tilesContext, AttributeContext attributeContext) { if (tilesContext instanceof DispatchRequest) { try { ((DispatchRequest) tilesContext).include(url); } catch (IOException e) { throw new PreparerException("The inclusion of the URL " + url + " threw an I/O exception", e); } } else { throw new PreparerException("This preparer is restricted to web environments"); } }
UrlPreparer implements ViewPreparer { @Override public void execute(Request tilesContext, AttributeContext attributeContext) { if (tilesContext instanceof DispatchRequest) { try { ((DispatchRequest) tilesContext).include(url); } catch (IOException e) { throw new PreparerException("The inclusion of the URL " + url + " threw an I/O exception", e); } } else { throw new PreparerException("This preparer is restricted to web environments"); } } }
UrlPreparer implements ViewPreparer { @Override public void execute(Request tilesContext, AttributeContext attributeContext) { if (tilesContext instanceof DispatchRequest) { try { ((DispatchRequest) tilesContext).include(url); } catch (IOException e) { throw new PreparerException("The inclusion of the URL " + url + " threw an I/O exception", e); } } else { throw new PreparerException("This preparer is restricted to web environments"); } } UrlPreparer(String url); }
UrlPreparer implements ViewPreparer { @Override public void execute(Request tilesContext, AttributeContext attributeContext) { if (tilesContext instanceof DispatchRequest) { try { ((DispatchRequest) tilesContext).include(url); } catch (IOException e) { throw new PreparerException("The inclusion of the URL " + url + " threw an I/O exception", e); } } else { throw new PreparerException("This preparer is restricted to web environments"); } } UrlPreparer(String url); @Override void execute(Request tilesContext,
            AttributeContext attributeContext); }
UrlPreparer implements ViewPreparer { @Override public void execute(Request tilesContext, AttributeContext attributeContext) { if (tilesContext instanceof DispatchRequest) { try { ((DispatchRequest) tilesContext).include(url); } catch (IOException e) { throw new PreparerException("The inclusion of the URL " + url + " threw an I/O exception", e); } } else { throw new PreparerException("This preparer is restricted to web environments"); } } UrlPreparer(String url); @Override void execute(Request tilesContext,
            AttributeContext attributeContext);  }