{
String requestedResource = "/org/apache/tapestry/asset/tapestry-in-action.png";
WebRequest request = newMock(WebRequest.class);
checkOrder(request, false);
WebResponse response = newMock(WebResponse.class);
WebContext context = newMock(WebContext.class);
IRequestCycle cycle = newMock(IRequestCycle.class);
ResourceMatcher matcher = newMock(ResourceMatcher.class);
ClassResolver resolver = new DefaultClassResolver();
URLConnection url = resolver.getResource(requestedResource).openConnection();
AssetService service = new AssetService();
service.setRequest(request);
service.setResponse(response);
service.setLog(LogFactory.getLog("test"));
service.setUnprotectedMatcher(matcher);
service.setClassResolver(resolver);
service.setContext(context);
expect(cycle.getParameter("path")).andReturn(requestedResource);
expect(cycle.getParameter("digest")).andReturn(null);
expect(matcher.containsResource(requestedResource)).andReturn(true);
expect(request.getDateHeader("If-Modified-Since")).andReturn(-1L);
expect(context.getMimeType(requestedResource)).andReturn("image/png");
response.setDateHeader("Last-Modified", url.getLastModified());
response.setDateHeader("Expires", service._expireTime);
response.setHeader("Cache-Control", "public, max-age=" + (AssetService.MONTH_SECONDS * 3));