### Question:
SanitizingProxyUriManager implements ProxyUriManager { public List<Uri> make(List<ProxyUri> ctx, Integer forcedRefresh) { List<Uri> origUris = wrapped.make(ctx, forcedRefresh); List<Uri> sanitizedUris = Lists.newArrayListWithCapacity(origUris.size()); for (Uri origUri : origUris) { UriBuilder newUri = new UriBuilder(origUri); newUri.addQueryParameter(Param.SANITIZE.getKey(), "1"); if (expectedMime != null) { newUri.addQueryParameter(Param.REWRITE_MIME_TYPE.getKey(), expectedMime); } sanitizedUris.add(newUri.toUri()); } return sanitizedUris; } SanitizingProxyUriManager(ProxyUriManager wrapped, String expectedMime); ProxyUri process(Uri uri); List<Uri> make(List<ProxyUri> ctx, Integer forcedRefresh);  }### Answer:
@Test public void makeSingleNoMime() throws Exception { Capture<List<ProxyUri>> uriCapture = new Capture<List<ProxyUri>>(); Capture<Integer> intCapture = new Capture<Integer>(); List<ProxyUri> input = Lists.newArrayList(proxyUri); List<Uri> output = Lists.newArrayList(uri); Integer refresh = new Integer(0); expect(uriManager.make(capture(uriCapture), capture(intCapture))) .andReturn(output).once(); replay(uriManager); SanitizingProxyUriManager rewriter = makeRewriter(null); List<Uri> returned = rewriter.make(input, refresh); verify(uriManager); assertSame(uriCapture.getValue(), input); assertSame(intCapture.getValue(), refresh); assertEquals(1, returned.size()); assertEquals("1", returned.get(0).getQueryParameter(Param.SANITIZE.getKey())); assertNull(returned.get(0).getQueryParameter(Param.REWRITE_MIME_TYPE.getKey())); }
@Test public void makeSingleExpectedMime() throws Exception { Capture<List<ProxyUri>> uriCapture = new Capture<List<ProxyUri>>(); Capture<Integer> intCapture = new Capture<Integer>(); List<ProxyUri> input = Lists.newArrayList(proxyUri); List<Uri> output = Lists.newArrayList(uri); Integer refresh = new Integer(0); String mime = "my/mime"; expect(uriManager.make(capture(uriCapture), capture(intCapture))) .andReturn(output).once(); replay(uriManager); SanitizingProxyUriManager rewriter = makeRewriter(mime); List<Uri> returned = rewriter.make(input, refresh); verify(uriManager); assertSame(uriCapture.getValue(), input); assertSame(intCapture.getValue(), refresh); assertEquals(1, returned.size()); assertEquals("1", returned.get(0).getQueryParameter(Param.SANITIZE.getKey())); assertEquals(mime, returned.get(0).getQueryParameter(Param.REWRITE_MIME_TYPE.getKey())); }
@Test public void makeList() throws Exception { Capture<List<ProxyUri>> uriCapture = new Capture<List<ProxyUri>>(); Capture<Integer> intCapture = new Capture<Integer>(); List<ProxyUri> input = Lists.newArrayList(proxyUri); Uri uri2 = new UriBuilder().toUri(); List<Uri> output = Lists.newArrayList(uri, uri2); Integer refresh = new Integer(0); String mime = "my/mime"; expect(uriManager.make(capture(uriCapture), capture(intCapture))) .andReturn(output).once(); replay(uriManager); SanitizingProxyUriManager rewriter = makeRewriter(mime); List<Uri> returned = rewriter.make(input, refresh); verify(uriManager); assertSame(uriCapture.getValue(), input); assertSame(intCapture.getValue(), refresh); assertEquals(2, returned.size()); assertEquals("1", returned.get(0).getQueryParameter(Param.SANITIZE.getKey())); assertEquals(mime, returned.get(0).getQueryParameter(Param.REWRITE_MIME_TYPE.getKey())); assertEquals("1", returned.get(1).getQueryParameter(Param.SANITIZE.getKey())); assertEquals(mime, returned.get(1).getQueryParameter(Param.REWRITE_MIME_TYPE.getKey())); }