AuthTokenManager implements TokenManager { private void refreshToken() { MultivaluedMap<String, String> mvm = new CaseInsensitiveMap<String>(); mvm.putSingle(OAuth2Constants.GRANT_TYPE, "refresh_token"); mvm.putSingle("refresh_token", accessTokenResponse.getRefreshToken()); consumeGrantTokenService(mvm); } AuthTokenManager(AuthSettings config); @Override void grantToken(); @Override String getAccessTokenString(); @Override String getRealm();  }
@Test public void testRefreshToken() throws Exception { when(response.getExpiresIn()).thenReturn(1000l); this.tokenManager.accessTokenResponse = response; this.tokenManager.expirationTime = 0; this.tokenManager.minTokenValidity = 100; String s = this.tokenManager.getAccessTokenString(); ArgumentCaptor<MultivaluedMap> mapCaptor = ArgumentCaptor.forClass(MultivaluedMap.class); verify(this.tokenService, times(1)).grantToken(eq("realm1"), anyString(), mapCaptor.capture()); MultivaluedMap<String, String> mvm = mapCaptor.getValue(); Assert.assertEquals("refresh_token", mvm.get(OAuth2Constants.GRANT_TYPE).get(0)); Assert.assertEquals("refreshToken", mvm.get("refresh_token").get(0)); }