### Question:
KeycloakResource { @POST @Path("/refresh/{refresh_token}") @Produces(MediaType.APPLICATION_JSON) public Response refreshAccessToken(@PathParam("refresh_token") String refreshToken) throws URISyntaxException { AccessTokenResponse tokenResponse; try { tokenResponse = keycloakService.generateAccessToken(refreshToken); } catch (DlabException e) { return Response.status(Response.Status.BAD_REQUEST) .location(new URI(logoutUri)) .build(); } return Response.ok(new TokenInfo(tokenResponse.getToken(), tokenResponse.getRefreshToken())).build(); } @Inject  KeycloakResource(SecurityService securityService, SelfServiceApplicationConfiguration configuration,
							SecurityDAO securityDAO, KeycloakService keycloakService); @GET @Produces(MediaType.TEXT_PLAIN) Response getLoginUri(); @POST @Produces(MediaType.APPLICATION_JSON) Response getUser(@QueryParam("code") String code); @POST @Path("/authorize") Response authorize(@Auth UserInfo userInfo); @GET @Path("/logout") Response getLogoutUrl(); @POST @Path("/refresh/{refresh_token}") @Produces(MediaType.APPLICATION_JSON) Response refreshAccessToken(@PathParam("refresh_token") String refreshToken);  }### Answer:
@Test public void refreshAccessToken() { when(keycloakService.generateAccessToken(anyString())).thenReturn(mock(AccessTokenResponse.class)); final Response response = resources.getJerseyTest() .target("oauth/refresh/" + "refresh_token") .request() .header("Authorization", "Bearer " + TOKEN) .post(Entity.json("")); assertEquals(HttpStatus.SC_OK, response.getStatus()); assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE)); verify(keycloakService).generateAccessToken(anyString()); verifyNoMoreInteractions(keycloakService); }