### Question:
JwtTokenExpiryFilter implements Filter { private boolean tokenExpiresBeforeThreshold(JwtTokenClaims jwtTokenClaims) { Date expiryDate = (Date)jwtTokenClaims.get("exp"); LocalDateTime expiry = LocalDateTime.ofInstant(expiryDate.toInstant(), ZoneId.systemDefault()); long minutesUntilExpiry = LocalDateTime.now().until(expiry, ChronoUnit.MINUTES); LOG.debug("Checking token at time {} with expirationTime {} for how many minutes until expiry: {}", LocalDateTime.now(), expiry, minutesUntilExpiry); if (minutesUntilExpiry <= expiryThresholdInMinutes) { LOG.debug("There are {} minutes until expiry which is equal to or less than the configured threshold {}", minutesUntilExpiry, expiryThresholdInMinutes); return true; } return false; } JwtTokenExpiryFilter(TokenValidationContextHolder contextHolder, long expiryThresholdInMinutes); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void destroy(); @Override void init(FilterConfig filterConfig); @Override String toString();  }### Answer:
@Test public void tokenExpiresBeforeThreshold() throws IOException, ServletException { setupMocks(LocalDateTime.now().plusMinutes(2)); JwtTokenExpiryFilter jwtTokenExpiryFilter = new JwtTokenExpiryFilter(tokenValidationContextHolder, EXPIRY_THRESHOLD); jwtTokenExpiryFilter.doFilter(servletRequest, servletResponse, filterChain); verify(servletResponse).setHeader(JwtTokenConstants.TOKEN_EXPIRES_SOON_HEADER, "true"); }