### Question:
AuthenticationService { protected RuntimeException handleJwtParserException(RuntimeException exception) { if (exception instanceof ExpiredJwtException) { final ExpiredJwtException expiredJwtException = (ExpiredJwtException) exception; log.debug("Token with id '{}' for user '{}' is expired.", expiredJwtException.getClaims().getId(), expiredJwtException.getClaims().getSubject()); return new TokenExpireException("Token is expired."); } if (exception instanceof JwtException) { log.debug(TOKEN_IS_NOT_VALID_DUE_TO, exception.getMessage()); return new TokenNotValidException("Token is not valid."); } log.debug(TOKEN_IS_NOT_VALID_DUE_TO, exception.getMessage()); return new TokenNotValidException("An internal error occurred while validating the token therefore the token is no longer valid."); }  @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 testHandleJwtParserException() { class AuthenticationServiceExceptionHandlerTest extends AuthenticationService { AuthenticationServiceExceptionHandlerTest() { super(null, null, null, null, null, null, null, null); } @Override public RuntimeException handleJwtParserException(RuntimeException re) { return super.handleJwtParserException(re); } } AuthenticationServiceExceptionHandlerTest as = new AuthenticationServiceExceptionHandlerTest(); Exception exception; exception = as.handleJwtParserException(new ExpiredJwtException(mock(Header.class), mock(Claims.class), "msg")); assertTrue(exception instanceof TokenExpireException); assertEquals("Token is expired.", exception.getMessage()); exception = as.handleJwtParserException(new JwtException("msg")); assertTrue(exception instanceof TokenNotValidException); assertEquals("Token is not valid.", exception.getMessage()); exception = as.handleJwtParserException(new RuntimeException("msg")); assertTrue(exception instanceof TokenNotValidException); assertEquals("An internal error occurred while validating the token therefore the token is no longer valid.", exception.getMessage()); }