### Question:
OAuthCallbackServlet extends InjectedServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { OAuthCallbackState callbackState = new OAuthCallbackState(stateCrypter, req.getParameter(CALLBACK_STATE_PARAM)); if (callbackState.getRealCallbackUrl() != null) { UriBuilder realUri = UriBuilder.parse(callbackState.getRealCallbackUrl()); Map<String, List<String>> params = UriBuilder.splitParameters(req.getQueryString()); for (Map.Entry<String, List<String>> entry : params.entrySet()) { realUri.putQueryParameter(entry.getKey(), entry.getValue()); } realUri.removeQueryParameter(CALLBACK_STATE_PARAM); HttpUtil.setCachingHeaders(resp, ONE_HOUR_IN_SECONDS, true); resp.sendRedirect(realUri.toString()); return; } HttpUtil.setCachingHeaders(resp, ONE_HOUR_IN_SECONDS, true); resp.setContentType("text/html; charset=UTF-8"); resp.getWriter().write(RESP_BODY); }  @Inject void setStateCrypter(@Named(OAuthFetcherConfig.OAUTH_STATE_CRYPTER) BlobCrypter stateCrypter); static final String CALLBACK_STATE_PARAM; static final String REAL_DOMAIN_PARAM; }### Answer:
@Test public void testServlet() throws Exception { OAuthCallbackServlet servlet = new OAuthCallbackServlet(); replay(); servlet.doGet(this.request, this.recorder); verify(); assertEquals("text/html; charset=UTF-8", this.recorder.getContentType()); String body = this.recorder.getResponseAsString(); Assert.assertNotSame("body is " + body, body.indexOf("window.close()"), -1); }