/** 测试从指定拦截器开始执行 */ @Test public void testDoInterceptorAfter() throws Exception { CountingPhaseInterceptor p1 = new CountingPhaseInterceptor("phase1", "p1"); CountingPhaseInterceptor p2 = new CountingPhaseInterceptor("phase2", "p2"); CountingPhaseInterceptor p3 = new CountingPhaseInterceptor("phase3", "p3"); message.getInterceptorChain(); EasyMock.expectLastCall().andReturn(chain).anyTimes(); control.replay(); chain.add(p1); chain.add(p2); chain.add(p3); chain.doInterceptAfter(message, p2.getId()); assertEquals(0, p1.invoked); assertEquals(0, p2.invoked); assertEquals(1, p3.invoked); chain.reset(); chain.doInterceptAt(message, p2.getId()); assertEquals(0, p1.invoked); assertEquals(1, p2.invoked); assertEquals(2, p3.invoked); }