@Test
  public void defaults() throws Exception {
    MockHttpServletRequest request = formLogin().buildRequest(this.servletContext);
    CsrfToken token =
        (CsrfToken)
            request.getAttribute(CsrfRequestPostProcessor.TestCsrfTokenRepository.ATTR_NAME);

    assertThat(request.getParameter("username")).isEqualTo("user");
    assertThat(request.getParameter("password")).isEqualTo("password");
    assertThat(request.getMethod()).isEqualTo("POST");
    assertThat(request.getParameter(token.getParameterName())).isEqualTo(token.getToken());
    assertThat(request.getRequestURI()).isEqualTo("/login");
    assertThat(request.getParameter("_csrf")).isNotNull();
  }
 private String createAuthorizationHeader(MockHttpServletRequest request) {
   String uri = request.getRequestURI();
   String responseDigest =
       generateDigest(
           username, realm, password, request.getMethod(), uri, qop, nonce, nc, cnonce);
   return "Digest username=\""
       + username
       + "\", realm=\""
       + realm
       + "\", nonce=\""
       + nonce
       + "\", uri=\""
       + uri
       + "\", response=\""
       + responseDigest
       + "\", qop="
       + qop
       + ", nc="
       + nc
       + ", cnonce=\""
       + cnonce
       + "\"";
 }
  @Test
  public void method() {
    MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);

    assertEquals("GET", request.getMethod());
  }