### Question:
FalconAuditFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { final String requestTimeISO9601 = SchemaHelper.formatDateUTC(new Date()); final HttpServletRequest httpRequest = (HttpServletRequest) request; final String requestId = UUID.randomUUID().toString(); final Thread currentThread = Thread.currentThread(); final String oldName = currentThread.getName(); try { currentThread.setName(formatName(oldName, requestId)); filterChain.doFilter(request, response); } finally { recordAudit(httpRequest, requestTimeISO9601); ((HttpServletResponse) response).setHeader(Servlets.REQUEST_ID, requestId); CurrentUser.clear(); currentThread.setName(oldName); } }  @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain filterChain); @Override void destroy();  }### Answer:
@Test public void testDoFilter() throws Exception { Filter filter = new FalconAuditFilter(); synchronized (StartupProperties.get()) { filter.init(mockConfig); } Mockito.when(mockRequest.getRemoteUser()).thenReturn(FalconTestUtil.TEST_USER_1); Mockito.when(mockRequest.getRemoteHost()).thenReturn("http: Mockito.when(mockRequest.getRequestURI()).thenReturn("http: filter.doFilter(mockRequest, mockResponse, mockChain); }