title: RestAssured oAuth2 http status code 401
body: <p>I'm trying to implement integration test using RestAssured library and Spring MVC REST oAuth2 secured endpoint.</p>
  
  <p>This is my test:</p>
  
  <pre><code>@Test
  public void testCreateDecision() throws Exception {
      File createDecisionJsonFile = ResourceUtils.getFile(getClass().getResource("/json/decisions/create-decision.json"));
  
      // @formatter:off
      final String createDecisionRequest = FileUtils.readFileToString(createDecisionJsonFile)
              .replace("{{name}}", "Test decision name")
              .replace("{{description}}", "Test decision description");
      // @formatter:on
  
      String accessToken = getAccessToken("user", "user");
  
      // @formatter:off
      given()
          .auth()
          .oauth2(accessToken, OAuthSignature.HEADER)
          .body(createDecisionRequest)
          .contentType("application/json; charset=UTF-8")
      .when()
          .post(format("http://localhost:%d/api/v1.0/decisions/create", port))
      .then()
          .statusCode(200)
          .contentType(ContentType.JSON)
          .body("id", notNullValue())
          .body("createDate", notNullValue());
      // @formatter:on
  
  }
  </code></pre>
  
  <p>The accessToken is valid but I'm continuously getting 401 http code.
  What could be wrong with my code ?</p>