### Question:
RpcServlet extends InjectedServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String reqValue; String callbackValue; try { if (this.isJSONPAllowed) { HttpUtil.isJSONP(request); callbackValue = validateParameterValue(request, GET_REQUEST_CALLBACK_PARAM); } else { callbackValue = validateParameterValueNull(request, GET_REQUEST_CALLBACK_PARAM); } reqValue = validateParameterValue(request, GET_REQUEST_REQ_PARAM); } catch (IllegalArgumentException e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); LOG.log(Level.INFO, e.getMessage(), e); return; } Result result = process(request, response, reqValue); if (result.isSuccess()) { if (callbackValue != null) { response.getWriter().write(callbackValue + '(' + result.getOutput() + ')'); } else { response.getWriter().write(result.getOutput()); } } else { response.getWriter().write(result.getOutput()); } }  @Inject void setJsonRpcHandler(JsonRpcHandler jsonHandler); @Inject void setJSONPAllowed(
      @Named("shindig.allowJSONP") Boolean isJSONPAllowed);  }### Answer:
@Test public void testDoGetWithMissingReqParam() throws Exception { HttpServletRequest request = createGetRequest(null, "function"); HttpServletResponse response = createHttpResponse(null, HttpServletResponse.SC_BAD_REQUEST); servlet.doGet(request, response); verify(response); }
@Test public void testDoGetWithMissingCallbackParam() throws Exception { HttpServletRequest request = createGetRequest("{\"gadgets\":[]}", null); HttpServletResponse response = createHttpResponse(null, HttpServletResponse.SC_BAD_REQUEST); servlet.doGet(request, response); verify(response); }
@Test public void testDoGetWithBadCallbackParamValue() throws Exception { HttpServletRequest request = createGetRequest("{\"gadgets\":[]}", "/'!="); HttpServletResponse response = createHttpResponse(null, HttpServletResponse.SC_BAD_REQUEST); servlet.doGet(request, response); verify(response); }