@Test public void addWebRequestInterceptor() throws Exception { registry.addWebRequestInterceptor(webRequestInterceptor1); List<HandlerInterceptor> interceptors = getInterceptorsForPath(null); assertEquals(1, interceptors.size()); verifyAdaptedInterceptor(interceptors.get(0), webRequestInterceptor1); }
@Test public void addWebRequestInterceptorsWithUrlPatterns() throws Exception { registry.addWebRequestInterceptor(webRequestInterceptor1).addPathPatterns("/path1"); registry.addWebRequestInterceptor(webRequestInterceptor2).addPathPatterns("/path2"); List<HandlerInterceptor> interceptors = getInterceptorsForPath("/path1"); assertEquals(1, interceptors.size()); verifyAdaptedInterceptor(interceptors.get(0), webRequestInterceptor1); interceptors = getInterceptorsForPath("/path2"); assertEquals(1, interceptors.size()); verifyAdaptedInterceptor(interceptors.get(0), webRequestInterceptor2); }