WebHookSecurityInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { return webHookAdapter.isValidRequest(request); }  @Override boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler);  }
@Test public void testPreHandle() throws Exception { MyTestWebHookAdapter adapter = new MyTestWebHookAdapter(); WebHookSecurityInterceptor interceptor = new WebHookSecurityInterceptor(); Field field = WebHookSecurityInterceptor.class.getDeclaredField("webHookAdapter"); field.setAccessible(true); field.set(interceptor, adapter); field.setAccessible(false); interceptor.preHandle(new MockHttpServletRequest(), new MockHttpServletResponse(), null); assertTrue(adapter.wasCalled("isValidRequest")); }