@Test
  public void doGetNormal() throws Exception {
    setupGet();
    expect(fixture.httpFetcher.fetch(request)).andReturn(response);
    fixture.replay();

    servlet.doGet(fixture.request, recorder);

    assertResponseOk(HttpResponse.SC_OK, RESPONSE_BODY);
  }
  @Test
  public void doPostHttpError() throws Exception {
    setupPost();
    expect(fixture.httpFetcher.fetch(request)).andReturn(HttpResponse.notFound());
    fixture.replay();

    servlet.doGet(fixture.request, recorder);

    assertResponseOk(HttpResponse.SC_NOT_FOUND, "");
  }
 @Before
 public void setUp() {
   servlet.setMakeRequestHandler(handler);
   expect(fixture.request.getHeaderNames()).andReturn(EMPTY_ENUM).anyTimes();
   expect(fixture.request.getParameter(MakeRequestHandler.METHOD_PARAM))
       .andReturn("GET")
       .anyTimes();
   expect(fixture.request.getParameter(ProxyBase.URL_PARAM))
       .andReturn(REQUEST_URL.toString())
       .anyTimes();
 }
  @Test
  public void doPostException() throws Exception {
    setupPost();
    expect(fixture.httpFetcher.fetch(request))
        .andThrow(
            new GadgetException(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT, ERROR_MESSAGE));
    fixture.replay();

    servlet.doPost(fixture.request, recorder);

    assertEquals(HttpServletResponse.SC_BAD_REQUEST, recorder.getHttpStatusCode());
    assertContains(ERROR_MESSAGE, recorder.getResponseAsString());
  }