### Question:
JwtTokenExpiryFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest) { addHeaderOnTokenExpiryThreshold((HttpServletResponse) response); chain.doFilter(request, response); } else { chain.doFilter(request, response); } } 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 tokenExpiresAfterThreshold() throws IOException, ServletException { setupMocks(LocalDateTime.now().plusMinutes(3)); JwtTokenExpiryFilter jwtTokenExpiryFilter = new JwtTokenExpiryFilter(tokenValidationContextHolder, EXPIRY_THRESHOLD); jwtTokenExpiryFilter.doFilter(servletRequest, servletResponse, filterChain); verify(servletResponse, never()).setHeader(JwtTokenConstants.TOKEN_EXPIRES_SOON_HEADER, "true"); }
@Test public void noValidToken() throws IOException, ServletException { JwtTokenExpiryFilter jwtTokenExpiryFilter = new JwtTokenExpiryFilter(mock(TokenValidationContextHolder.class), EXPIRY_THRESHOLD); jwtTokenExpiryFilter.doFilter(servletRequest, servletResponse, filterChain); }