@Test public void testAsJsonConcatException() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); HttpRequest req = new HttpRequest(URL4); expect(pipeline.execute(req)).andThrow( new GadgetException(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT)).anyTimes(); expectRequestWithUris(Lists.newArrayList(URL1, URL4), "_js"); servlet.doGet(request, recorder); verify(); String results = "_js={\r\n" + addLastVar(URL1.toString(), SCRT1_ESCAPED) + addConcatErrComment(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT, URL4.toString()) + "};\r\n"; assertEquals(results, recorder.getResponseAsString()); assertEquals(400, recorder.getHttpStatusCode()); }
@Test public void testConcatBadException() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); HttpRequest req = new HttpRequest(URL4); expect(pipeline.execute(req)).andThrow( new GadgetException(GadgetException.Code.HTML_PARSE_ERROR)).anyTimes(); expectRequestWithUris(Lists.newArrayList(URL1, URL4)); // Run the servlet servlet.doGet(request, recorder); verify(); String results = addComment(SCRT1, URL1.toString()) + addConcatErrComment(GadgetException.Code.HTML_PARSE_ERROR, URL4.toString()); assertEquals(results, recorder.getResponseAsString()); assertEquals(400, recorder.getHttpStatusCode()); }
@Test public void testAsJsonConcatException() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); HttpRequest req = new HttpRequest(URL4); expect(pipeline.execute(req)).andThrow( new GadgetException(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT)).anyTimes(); expectRequestWithUris(Lists.newArrayList(URL1, URL4), "_js"); servlet.doGet(request, recorder); verify(); String results = "_js={\r\n" + addLastVar(URL1.toString(), SCRT1_ESCAPED) + addConcatErrComment(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT, URL4.toString()) + "};\r\n"; assertEquals(results, recorder.getResponseAsString()); assertEquals(400, recorder.getHttpStatusCode()); }
@Test public void testAsJsonConcatBadException() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); HttpRequest req = new HttpRequest(URL4); expect(pipeline.execute(req)).andThrow( new GadgetException(GadgetException.Code.HTML_PARSE_ERROR)).anyTimes(); String results = "_js={\r\n" + addLastVar(URL1.toString(), SCRT1_ESCAPED) + addConcatErrComment(GadgetException.Code.HTML_PARSE_ERROR, URL4.toString()) + "};\r\n"; expectRequestWithUris(Lists.newArrayList(URL1, URL4), "_js"); // Run the servlet servlet.doGet(request, recorder); verify(); assertEquals(results, recorder.getResponseAsString()); assertEquals(400, recorder.getHttpStatusCode()); }
@Test public void testConcatBadException() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); HttpRequest req = new HttpRequest(URL4); expect(pipeline.execute(req)).andThrow( new GadgetException(GadgetException.Code.HTML_PARSE_ERROR)).anyTimes(); expectRequestWithUris(Lists.newArrayList(URL1, URL4)); // Run the servlet servlet.doGet(request, recorder); verify(); String results = addComment(SCRT1, URL1.toString()) + addConcatErrComment(GadgetException.Code.HTML_PARSE_ERROR, URL4.toString()); assertEquals(results, recorder.getResponseAsString()); assertEquals(400, recorder.getHttpStatusCode()); }
@Test public void testAsJsonConcatBadException() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); HttpRequest req = new HttpRequest(URL4); expect(pipeline.execute(req)).andThrow( new GadgetException(GadgetException.Code.HTML_PARSE_ERROR)).anyTimes(); String results = "_js={\r\n" + addLastVar(URL1.toString(), SCRT1_ESCAPED) + addConcatErrComment(GadgetException.Code.HTML_PARSE_ERROR, URL4.toString()) + "};\r\n"; expectRequestWithUris(Lists.newArrayList(URL1, URL4), "_js"); // Run the servlet servlet.doGet(request, recorder); verify(); assertEquals(results, recorder.getResponseAsString()); assertEquals(400, recorder.getHttpStatusCode()); }