Exemplo n.º 1
0
 @Test
 public void testAddOne() throws Exception {
   CountingPhaseInterceptor interceptor = new CountingPhaseInterceptor("phase1", "id1");
   control.replay();
   System.out.println(interceptor.getId());
   chain.add(interceptor);
   Iterator<Interceptor<? extends Message>> it = chain.iterator();
   Interceptor<? extends Message> next = it.next();
   assertSame(interceptor, next);
   assertTrue(!it.hasNext());
 }
Exemplo n.º 2
0
 /** 测试在同一个阶段的先后顺序 */
 @Test
 public void testAddTwoAtSamePhase() throws Exception {
   CountingPhaseInterceptor p1 = new CountingPhaseInterceptor("phase1", "p1");
   Set<String> after = new HashSet<String>();
   after.add("p1");
   CountingPhaseInterceptor p2 = new CountingPhaseInterceptor("phase1", "p2", null, after);
   chain.add(p2);
   chain.add(p1);
   Iterator<Interceptor<? extends Message>> it = chain.iterator();
   assertSame(p1, it.next());
   assertSame(p2, it.next());
   assertTrue(!it.hasNext());
 }