{
Duration defaultDuration = Duration.minutes(60);
// setup RequestCycle
BaseWicketTester tester = new BaseWicketTester();
RequestCycle requestCycle = ThreadContext.getRequestCycle();
Application.get().getResourceSettings().setDefaultCacheDuration(defaultDuration);
try
{
// version match
requestCycle.setMetaData(IResourceCachingStrategy.URL_VERSION, TEST_RESOURCE_VERSION);
AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();
strategy.decorateResponse(response, new TestResource());
assertEquals(WebResponse.MAX_CACHE_DURATION, response.getCacheDuration());
assertEquals(WebResponse.CacheScope.PUBLIC, response.getCacheScope());
// version mismatch
requestCycle.setMetaData(IResourceCachingStrategy.URL_VERSION, "foo");
response = new AbstractResource.ResourceResponse();
strategy.decorateResponse(response, new TestResource());
assertEquals(defaultDuration, response.getCacheDuration());