### Question:
Oauth2Controller implements Oauth2Api { @Override public TokenResponseTO getToken(Map<String, String> headers, Map<String, String> parameters) throws IOException { return mapper.map(oauth2Service.getToken(headers, new Parameters(parameters))); } Oauth2Controller(Oauth2Service oauth2Service); @Override HrefType getAuthorizationUrl(Map<String, String> headers, Map<String, String> parameters); @Override TokenResponseTO getToken(Map<String, String> headers, Map<String, String> parameters);  }### Answer:
@Test void getToken() throws Exception { when(oauth2Service.getToken(anyMap(), any())) .thenReturn(TestModelBuilder.buildTokenResponse()); mockMvc.perform(post("/oauth2/token")) .andExpect(status().isOk()) .andExpect(jsonPath("$.access_token", containsString(TestModelBuilder.ACCESS_TOKEN))) .andExpect(jsonPath("$.refresh_token", containsString(TestModelBuilder.REFRESH_TOKEN))) .andExpect(jsonPath("$.scope", containsString(TestModelBuilder.SCOPE))) .andExpect(jsonPath("$.expires_in", equalTo((int) TestModelBuilder.exripesInSeconds))) .andExpect(jsonPath("$.token_type", containsString(TestModelBuilder.TOKEN_TYPE))); verify(oauth2Service, times(1)) .getToken(anyMap(), any()); }