### Question:
AuthenticationService { @Cacheable(value = CACHE_VALIDATION_JWT_TOKEN, key = "#jwtToken", condition = "#jwtToken != null") public TokenAuthentication validateJwtToken(String jwtToken) { QueryResponse queryResponse = parseJwtToken(jwtToken); switch (queryResponse.getSource()) { case ZOWE: validateAndParseLocalJwtToken(jwtToken); break; case ZOSMF: zosmfService.validate(JWT, jwtToken); break; default: throw new TokenNotValidException("Unknown token type."); } TokenAuthentication tokenAuthentication = new TokenAuthentication(queryResponse.getUserId(), jwtToken); final boolean authenticated = !meAsProxy.isInvalidated(jwtToken); tokenAuthentication.setAuthenticated(authenticated); return tokenAuthentication; }  @PostConstruct void afterPropertiesSet(); String createJwtToken(String username, String domain, String ltpaToken); @CacheEvict(value = CACHE_VALIDATION_JWT_TOKEN, key = "#jwtToken") @Cacheable(value = CACHE_INVALIDATED_JWT_TOKENS, key = "#jwtToken", condition = "#jwtToken != null") Boolean invalidateJwtToken(String jwtToken, boolean distribute); @Cacheable(value = CACHE_INVALIDATED_JWT_TOKENS, unless = "true", key = "#jwtToken", condition = "#jwtToken != null") Boolean isInvalidated(String jwtToken); @Cacheable(value = CACHE_VALIDATION_JWT_TOKEN, key = "#jwtToken", condition = "#jwtToken != null") TokenAuthentication validateJwtToken(String jwtToken); @CachePut(value = "validationJwtToken", key = "#jwtToken", condition = "#jwtToken != null") TokenAuthentication createTokenAuthentication(String user, String jwtToken); boolean distributeInvalidate(String toInstanceId); TokenAuthentication validateJwtToken(TokenAuthentication token); QueryResponse parseJwtToken(String jwtToken); Optional<String> getJwtTokenFromRequest(HttpServletRequest request); String getLtpaTokenWithValidation(String jwtToken); String getLtpaToken(String jwtToken);  }### Answer:
@Test void shouldThrowExceptionWhenTokenIsExpired() { TokenAuthentication token = new TokenAuthentication(createExpiredJwtToken(privateKey)); assertThrows( TokenExpireException.class, () -> authService.validateJwtToken(token) ); }
@Test void shouldThrowExceptionWhenOccurUnexpectedException() { assertThrows( TokenNotValidException.class, () -> authService.validateJwtToken((String) null) ); }
@Test void shouldThrowExceptionWhenOccurUnexpectedException2() { assertThrows( TokenNotValidException.class, () -> authService.validateJwtToken((TokenAuthentication) null) ); }