### Question:
GadgetsHandlerService { protected ProxyUri createProxyUri(GadgetsHandlerApi.ProxyRequest request) { ProxyUriManager.ProxyUri proxyUri = new ProxyUriManager.ProxyUri(request.getRefresh(), request.getDebug(), request.getIgnoreCache(), request.getContainer(), request.getGadget(), request.getUrl()); proxyUri.setFallbackUrl(request.getFallbackUrl()) .setRewriteMimeType(request.getRewriteMimeType()) .setSanitizeContent(request.getSanitize()); GadgetsHandlerApi.ImageParams image = request.getImageParams(); if (image != null) { proxyUri.setResize( image.getWidth(), image.getHeight(), image.getQuality(), image.getDoNotExpand()); } return proxyUri; } @Inject  GadgetsHandlerService(TimeSource timeSource, Processor processor,
      IframeUriManager iframeUriManager, SecurityTokenCodec securityTokenCodec,
      ProxyUriManager proxyUriManager, JsUriManager jsUriManager, ProxyHandler proxyHandler,
      JsServingPipeline jsPipeline, JsRequestBuilder jsRequestBuilder,
      @Named("shindig.cache.xml.refreshInterval") long specRefreshInterval,
      BeanFilter beanFilter, CajaContentRewriter cajaContentRewriter,
      GadgetAdminStore gadgetAdminStore,
      FeatureRegistryProvider featureRegistryProvider,
      ModuleIdManager moduleIdManager,
      ContainerConfig config); GadgetsHandlerApi.MetadataResponse getMetadata(GadgetsHandlerApi.MetadataRequest request); GadgetsHandlerApi.TokenResponse getToken(GadgetsHandlerApi.TokenRequest request); GadgetsHandlerApi.JsResponse getJs(GadgetsHandlerApi.JsRequest request); GadgetsHandlerApi.ProxyResponse getProxy(GadgetsHandlerApi.ProxyRequest request); static GadgetsHandlerApi.MessageLevel convertMessageLevel(String name); GadgetsHandlerApi.CajaResponse getCaja(GadgetsHandlerApi.CajaRequest request); GadgetsHandlerApi.BaseResponse createErrorResponse(Uri uri, Exception e,
      String defaultMsg); GadgetsHandlerApi.BaseResponse createErrorResponse(Uri url, int code, String error);  }### Answer:
@Test public void testCreateProxyUri() throws Exception { GadgetsHandlerApi.ImageParams image = mock(GadgetsHandlerApi.ImageParams.class); expect(image.getDoNotExpand()).andStubReturn(true); expect(image.getHeight()).andStubReturn(120); expect(image.getWidth()).andStubReturn(210); expect(image.getQuality()).andStubReturn(77); GadgetsHandlerApi.ProxyRequest request = mock(GadgetsHandlerApi.ProxyRequest.class); expect(request.getContainer()).andStubReturn(CONTAINER); expect(request.getUrl()).andStubReturn(RESOURCE); expect(request.getRefresh()).andStubReturn(new Integer(333)); expect(request.getDebug()).andStubReturn(true); expect(request.getFallbackUrl()).andStubReturn(FALLBACK); expect(request.getGadget()).andStubReturn(FakeProcessor.SPEC_URL.toString()); expect(request.getIgnoreCache()).andStubReturn(true); expect(request.getImageParams()).andStubReturn(image); expect(request.getRewriteMimeType()).andStubReturn("image/png"); expect(request.getSanitize()).andStubReturn(true); replay(); ProxyUri pUri = gadgetHandler.createProxyUri(request); ProxyUri expectedUri = new ProxyUri(333, true, true, CONTAINER, FakeProcessor.SPEC_URL.toString(), RESOURCE); expectedUri.setRewriteMimeType("image/png").setSanitizeContent(true); expectedUri.setResize(210, 120, 77, true).setFallbackUrl(FALLBACK); assertEquals(pUri, expectedUri); verify(); }