@Test
  public void requestParameterFromQueryWithEncoding() throws Exception {
    this.builder = new MockHttpServletRequestBuilder(HttpMethod.GET, "/?foo={value}", "bar=baz");

    MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);

    assertEquals("foo=bar=baz", request.getQueryString());
    assertEquals("bar=baz", request.getParameter("foo"));
  }
  @Test
  public void requestParameterFromQueryNull() throws Exception {
    this.builder = new MockHttpServletRequestBuilder(HttpMethod.GET, "/?foo");

    MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);
    Map<String, String[]> parameterMap = request.getParameterMap();

    assertArrayEquals(new String[] {null}, parameterMap.get("foo"));
    assertEquals("foo", request.getQueryString());
  }
  @Test
  public void requestParameterFromQueryList() throws Exception {
    this.builder = new MockHttpServletRequestBuilder(HttpMethod.GET, "/?foo[0]=bar&foo[1]=baz");

    MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);

    assertEquals("foo[0]=bar&foo[1]=baz", request.getQueryString());
    assertEquals("bar", request.getParameter("foo[0]"));
    assertEquals("baz", request.getParameter("foo[1]"));
  }
  @Test
  public void uri() throws Exception {
    String uri =
        "https://java.sun.com:8080/javase/6/docs/api/java/util/BitSet.html?foo=bar#and(java.util.BitSet)";
    this.builder = new MockHttpServletRequestBuilder(HttpMethod.GET, uri);
    MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);

    assertEquals("https", request.getScheme());
    assertEquals("foo=bar", request.getQueryString());
    assertEquals("java.sun.com", request.getServerName());
    assertEquals(8080, request.getServerPort());
    assertEquals("/javase/6/docs/api/java/util/BitSet.html", request.getRequestURI());
    assertEquals(
        "https://java.sun.com:8080/javase/6/docs/api/java/util/BitSet.html",
        request.getRequestURL().toString());
  }