@Test void getApplicationTokenDetails() { TokenDetails tokenDetails = new TokenDetails(); when(usersTokenService.retrieveUsersTokenDetails()).thenReturn(tokenDetails); TokenDetails applicationTokenDetails = new TokenDetails("accessToken444", "refreshToken4", LocalDateTime.now()); when(applicationTokenService.getApplicationTokenDetails()).thenReturn(applicationTokenDetails); assertEquals(service.getTokenDetails(), applicationTokenDetails); }
public TokenDetails getTokenDetails() { TokenDetails tokenDetails = usersTokenService.retrieveUsersTokenDetails(); if (tokenDetails.isNotEmpty()) { logger.debug("return user's token details: {}", tokenDetails); return tokenDetails; } tokenDetails = applicationTokenService.getApplicationTokenDetails(); if (tokenDetails.isEmpty()) { logger.warn("return empty token details"); } return tokenDetails; }
TokenService { public TokenDetails getTokenDetails() { TokenDetails tokenDetails = usersTokenService.retrieveUsersTokenDetails(); if (tokenDetails.isNotEmpty()) { logger.debug("return user's token details: {}", tokenDetails); return tokenDetails; } tokenDetails = applicationTokenService.getApplicationTokenDetails(); if (tokenDetails.isEmpty()) { logger.warn("return empty token details"); } return tokenDetails; } }
TokenService { public TokenDetails getTokenDetails() { TokenDetails tokenDetails = usersTokenService.retrieveUsersTokenDetails(); if (tokenDetails.isNotEmpty()) { logger.debug("return user's token details: {}", tokenDetails); return tokenDetails; } tokenDetails = applicationTokenService.getApplicationTokenDetails(); if (tokenDetails.isEmpty()) { logger.warn("return empty token details"); } return tokenDetails; } @Autowired  TokenService(UsersTokenService usersTokenService,
                        ApplicationTokenService applicationTokenService,
                        OAuthClient oAuthClient); }
TokenService { public TokenDetails getTokenDetails() { TokenDetails tokenDetails = usersTokenService.retrieveUsersTokenDetails(); if (tokenDetails.isNotEmpty()) { logger.debug("return user's token details: {}", tokenDetails); return tokenDetails; } tokenDetails = applicationTokenService.getApplicationTokenDetails(); if (tokenDetails.isEmpty()) { logger.warn("return empty token details"); } return tokenDetails; } @Autowired  TokenService(UsersTokenService usersTokenService,
                        ApplicationTokenService applicationTokenService,
                        OAuthClient oAuthClient); TokenDetails getTokenDetails(); TokenDetails getTokenByRefreshToken(String refreshToken); }
TokenService { public TokenDetails getTokenDetails() { TokenDetails tokenDetails = usersTokenService.retrieveUsersTokenDetails(); if (tokenDetails.isNotEmpty()) { logger.debug("return user's token details: {}", tokenDetails); return tokenDetails; } tokenDetails = applicationTokenService.getApplicationTokenDetails(); if (tokenDetails.isEmpty()) { logger.warn("return empty token details"); } return tokenDetails; } @Autowired  TokenService(UsersTokenService usersTokenService,
                        ApplicationTokenService applicationTokenService,
                        OAuthClient oAuthClient); TokenDetails getTokenDetails(); TokenDetails getTokenByRefreshToken(String refreshToken);  }