### Question:
DefaultInvalidationService implements InvalidationService { public void invalidateApplicationResources(Set<Uri> uris, SecurityToken token) { for (Uri uri : uris) { httpCache.removeResponse(new HttpRequest(uri)); } } @Inject  DefaultInvalidationService(HttpCache httpCache, CacheProvider cacheProvider);   DefaultInvalidationService(HttpCache httpCache, CacheProvider cacheProvider, AtomicLong marker); void invalidateApplicationResources(Set<Uri> uris, SecurityToken token); void invalidateUserResources(Set<String> opensocialIds, SecurityToken token); boolean isValid(HttpRequest request, HttpResponse response); HttpResponse markResponse(HttpRequest request, HttpResponse response); static final String CACHE_NAME; }### Answer:
@Test public void testInvalidateUrl() throws Exception { cache.addResponse(new HttpRequest(URI), CACHEABLE); assertEquals(1, cacheProvider.createCache(DefaultHttpCache.CACHE_NAME).getSize()); service.invalidateApplicationResources( ImmutableSet.of(URI), appxToken); assertEquals(0, cacheProvider.createCache(DefaultHttpCache.CACHE_NAME).getSize()); }
@Test public void testFetchInvalidatedContent() throws Exception { cache.addResponse(new HttpRequest(URI), CACHEABLE); service.invalidateApplicationResources( ImmutableSet.of(URI), appxToken); fetcher.response = new HttpResponseBuilder(CACHEABLE).setResponseString("NEWCONTENT1"). create(); assertEquals(requestPipeline.execute(new HttpRequest(URI)), fetcher.response); }