### Question:
CajaContentRewriter implements GadgetRewriter { @VisibleForTesting static ParseTreeNode parse(InputSource is, CharProducer cp, String mime, MessageQueue mq) throws ParseException { ParseTreeNode ptn; if (mime.contains("javascript")) { JsLexer lexer = new JsLexer(cp); JsTokenQueue tq = new JsTokenQueue(lexer, is); if (tq.isEmpty()) { return null; } Parser p = new Parser(tq, mq); ptn = p.parse(); tq.expectEmpty(); } else { DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq); ptn = new Dom(p.parseFragment()); p.getTokenQueue().expectEmpty(); } return ptn; } @Inject  CajaContentRewriter(CacheProvider cacheProvider, RequestPipeline requestPipeline,
                             HtmlSerializer htmlSerializer, ProxyUriManager proxyUriManager); CajoledResult rewrite(Uri uri, String container, String mime,
      boolean es53, boolean debug); CajoledResult rewrite(Uri gadgetUri, String container,
      ParseTreeNode root, boolean es53, boolean debug); void rewrite(Gadget gadget, MutableContent mc); static final String CAJOLED_MODULES; }### Answer:
@Test public void testUrlRewrite() throws Exception { String uri = "http: String unproxied = uri; String proxied = "http: expect(proxyUriManager.make(EasyMock.anyObject(List.class), EasyMock.isNull(Integer.class))) .andReturn(ImmutableList.<Uri>of(Uri.parse(proxied))).anyTimes(); replay(proxyUriManager); assertUrlRewritten("a", "href", uri, unproxied); assertUrlRewritten("area", "href", uri, unproxied); assertUrlRewritten("img", "src", uri, proxied); assertUrlRewritten("blockquote", "cite", uri, unproxied); assertUrlRewritten("q", "cite", uri, unproxied); assertUrlRewritten("del", "cite", uri, unproxied); assertUrlRewritten("ins", "cite", uri, unproxied); }