### Question:
BaseRequestItem implements RequestItem { public <T> T getTypedParameter(String parameterName, Class<T> dataTypeClass) { try { String json = getParameter(parameterName); if (json == null) { throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "missing data for " + parameterName); } return converter.convertToObject(json, dataTypeClass); } catch (RuntimeException e) { if (e.getCause() instanceof JSONException) throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); throw e; } } BaseRequestItem(Map<String, String[]> parameters,
      SecurityToken token,
      BeanConverter converter,
      BeanJsonConverter jsonConverter);  BaseRequestItem(JSONObject parameters,
      Map<String, FormDataItem> formItems,
      SecurityToken token,
      BeanConverter converter,
      BeanJsonConverter jsonConverter); String getAppId(); Date getUpdatedSince(); String getSortBy(); SortOrder getSortOrder(); String getFilterBy(); int getStartIndex(); int getCount(); FilterOperation getFilterOperation(); String getFilterValue(); Set<String> getFields(); Set<String> getFields(Set<String> defaultValue); SecurityToken getToken(); T getTypedParameter(String parameterName, Class<T> dataTypeClass); T getOptionalTypedParameter(String parameterName, Class<T> dataTypeClass); T getTypedRequest(Class<T> dataTypeClass); String getParameter(String paramName); String getParameter(String paramName, String defaultValue); Map<String, Object> getParameters(); List<String> getListParameter(String paramName); @VisibleForTesting void setParameter(String paramName, Object paramValue); FormDataItem getFormMimePart(String partName); Object getAttribute(String val); void setAttribute(String val, Object obj); Set<String> getParameterNames();  }### Answer:
@Test public void testGetTypedParameter() throws Exception { request.setParameter("anykey", "{name: 'Bob', id: '1234'}"); InputData input = request.getTypedParameter("anykey", InputData.class); assertEquals("Bob", input.name); assertEquals(1234, input.id); }
@Test(expected = ProtocolException.class) public void testGetTypedParameterEmpty() throws Exception { request.getTypedParameter("empty", InputData.class); }