### Question:
TokenService { public TokenDetails getTokenByRefreshToken(String refreshToken) throws ObtainRefreshTokenException { return oAuthClient.obtainTokenDetailsByRefreshToken(refreshToken); } @Autowired  TokenService(UsersTokenService usersTokenService,
                        ApplicationTokenService applicationTokenService,
                        OAuthClient oAuthClient); TokenDetails getTokenDetails(); TokenDetails getTokenByRefreshToken(String refreshToken);  }### Answer:
@Test void getTokenByRefreshToken() { String refreshToken = "refresh-token333"; TokenDetails tokenDetails = new TokenDetails(); when(oAuthClient.obtainTokenDetailsByRefreshToken(refreshToken)).thenReturn(tokenDetails); assertSame(service.getTokenByRefreshToken(refreshToken), tokenDetails); }
@Test void getTokenByRefreshTokenException() { String refreshToken = "refresh-token333"; when(oAuthClient.obtainTokenDetailsByRefreshToken(refreshToken)) .thenThrow(new ObtainRefreshTokenException()); assertThrows(ObtainRefreshTokenException.class, () -> service.getTokenByRefreshToken(refreshToken)); }