### Question:
SimpleQueryString extends AbstractActiveSyncRequest { @Override public <T> T getParameter(String key) { String value = request.getParameter(key); if (value == null) { return null; } else if (key.equalsIgnoreCase("CollectionId")) { return (T) CollectionId.of(value); } else if (key.equalsIgnoreCase("ItemId")) { return (T) ServerId.of(value); } return (T) value; } SimpleQueryString(HttpServletRequest request); @Override T getParameter(String key); @Override InputStream getInputStream(); @Override String getHeader(String name); @Override HttpServletRequest getHttpServletRequest(); @Override DeviceId getDeviceId(); @Override String getDeviceType(); @Override String getCommand(); @Override String getMsPolicyKey(); @Override String getMSASProtocolVersion();  }### Answer:
@Test public void itemIdAndCollectionIdShouldNotBeRequired() { HttpServletRequest httpRequest = createMock(HttpServletRequest.class); expect(httpRequest.getParameter("ItemId")).andReturn(null); expect(httpRequest.getParameter("CollectionId")).andReturn(null); replay(httpRequest); SimpleQueryString asRequest = new SimpleQueryString(httpRequest); assertThat(asRequest.getParameter("ItemId")).isEqualTo(null); assertThat(asRequest.getParameter("CollectionId")).isEqualTo(null); verify(httpRequest); }
@Test public void itemIdAndCollectionIdShouldBeTypedWhenRightValue() { HttpServletRequest httpRequest = createMock(HttpServletRequest.class); expect(httpRequest.getParameter("ItemId")).andReturn("12:5"); expect(httpRequest.getParameter("CollectionId")).andReturn("999"); replay(httpRequest); SimpleQueryString asRequest = new SimpleQueryString(httpRequest); assertThat(asRequest.getParameter("ItemId")).isEqualTo(ServerId.of("12:5")); assertThat(asRequest.getParameter("CollectionId")).isEqualTo(CollectionId.of(999)); verify(httpRequest); }