### Question:
SassCompilingFilter implements Filter { public void setCompiler(Compiler compiler) { this.compiler = compiler; }  void init(FilterConfig filterConfig); void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); void destroy(); void setCompiler(Compiler compiler);  }### Answer:
@Test public void initShouldCompileFiles() throws ServletException { com.darrinholst.sass_java.Compiler compiler = mock(Compiler.class); filter.setCompiler(compiler); initFilter(); verify(compiler).compile(); }
@Test public void compilerShouldNotBeInvokedIfItIsAlreadyCompiling() throws Exception { StubCompiler compiler = new StubCompiler(1L, 2000L, 1L); filter.setCompiler(compiler); setupDefaultDirectoriesAndConfigFile(); initFilter(); Thread thread = processRequestOnAnotherThread(servletRequest); clock.incrementSeconds(4); runFilter(servletRequest); thread.join(); assertEquals(2, compiler.getNumberOfCompiles()); }