### Question:
FacesHandlerInterceptor extends HandlerInterceptorAdapter implements ServletContextAware { @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { DefaultSpringFacesContext context = getSpringFacesContext(false); if (context != null) { context.release(); } }  void setServletContext(ServletContext servletContext); @Override boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler); @Override void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex); void setLifecycleId(String lifecycleId);  }### Answer:
@Test public void shouldIgnoreNullSpringFacesContextAfterCompletion() throws Exception { assertThat(SpringFacesContext.getCurrentInstance(false), is(nullValue())); this.interceptor.afterCompletion(this.request, this.response, this.handler, null); }
@Test public void shouldReleaseSpringFacesContextAfterCompletion() throws Exception { DefaultSpringFacesContext context = mock(DefaultSpringFacesContext.class); SpringFacesContextSetter.setCurrentInstance(context); assertThat(SpringFacesContext.getCurrentInstance(false), is(not(nullValue()))); this.interceptor.afterCompletion(this.request, this.response, this.handler, null); verify(context).release(); }