### Question:
DefaultOAuth2HttpClient implements OAuth2HttpClient { @Override public OAuth2AccessTokenResponse post(OAuth2HttpRequest oAuth2HttpRequest) { Assert.notNull(oAuth2HttpRequest, "OAuth2HttpRequest cannot be null"); RequestEntity<?> request = convert(oAuth2HttpRequest); try { return restTemplate.exchange(request, OAuth2AccessTokenResponse.class).getBody(); } catch (HttpStatusCodeException e) { throw new OAuth2ClientException(String.format("received %s from tokenendpoint=%s with responsebody=%s", e.getStatusCode(), oAuth2HttpRequest.getTokenEndpointUrl(), e.getResponseBodyAsString()), e); } } DefaultOAuth2HttpClient(RestTemplateBuilder restTemplateBuilder); @Override OAuth2AccessTokenResponse post(OAuth2HttpRequest oAuth2HttpRequest);  }### Answer:
@Test void testPostAllHeadersAndFormParametersShouldBePresent() throws InterruptedException { server.enqueue(jsonResponse(TOKEN_RESPONSE)); OAuth2HttpRequest request = OAuth2HttpRequest.builder() .tokenEndpointUrl(tokenEndpointUrl) .formParameter("param1", "value1") .formParameter("param2", "value2") .oAuth2HttpHeaders(OAuth2HttpHeaders.builder() .header("header1", "headervalue1") .header("header2", "headervalue2") .build()) .build(); client.post(request); RecordedRequest recordedRequest = server.takeRequest(); var body = recordedRequest.getBody().readUtf8(); assertThat(recordedRequest.getHeaders().get("header1")).isEqualTo("headervalue1"); assertThat(recordedRequest.getHeaders().get("header2")).isEqualTo("headervalue2"); assertThat(body).contains("param1=value1"); assertThat(body).contains("param2=value2"); }