CompositeInterceptorMatcher implements ActionInterceptorMatcher { @Override public boolean isInterceptorApplicable(ActionInformation actionInformation, Class<? extends ActionInterceptor> interceptor) { return operation.operateWith(matcherList, actionInformation, interceptor); } CompositeInterceptorMatcher();  CompositeInterceptorMatcher(ActionInterceptorMatcher... matcherArray);  CompositeInterceptorMatcher(List<ActionInterceptorMatcher> matcherList);  CompositeInterceptorMatcher(LogicalOperation operation, List<ActionInterceptorMatcher> matcherList);  CompositeInterceptorMatcher(LogicalOperation operation, ActionInterceptorMatcher... matcherArray); @Override boolean isInterceptorApplicable(ActionInformation actionInformation, Class<? extends ActionInterceptor> interceptor); void setMatcherArray(ActionInterceptorMatcher... matcherArray); void setOperation(LogicalOperation operation); void setMatcherList(List<ActionInterceptorMatcher> matcherList);  }
@Test public void shouldInterceptorMatchWithOrOperator() throws Exception { ActionInformation actionInformation = null; ActionInterceptorMatcher matcher1 = new FalseMatcher(); ActionInterceptorMatcher matcher2 = new FalseMatcher(); ActionInterceptorMatcher matcher3 = new TrueMatcher(); CompositeInterceptorMatcher compositeInterceptorMatcher = new CompositeInterceptorMatcher(LogicalOperation.OR, matcher1, matcher2, matcher3); boolean result = compositeInterceptorMatcher.isInterceptorApplicable(actionInformation, MockActionInterceptor.class); assertTrue(result); }
@Test public void shouldInterceptorNotMatchWithOrOperator() throws Exception { ActionInformation actionInformation = null; ActionInterceptorMatcher matcher1 = new FalseMatcher(); ActionInterceptorMatcher matcher2 = new FalseMatcher(); ActionInterceptorMatcher matcher3 = new FalseMatcher(); CompositeInterceptorMatcher compositeInterceptorMatcher = new CompositeInterceptorMatcher(LogicalOperation.OR, matcher1, matcher2, matcher3); boolean result = compositeInterceptorMatcher.isInterceptorApplicable(actionInformation, MockActionInterceptor.class); assertFalse(result); }
@Test public void shouldInterceptorMatchWithNotOperator() throws Exception { ActionInformation actionInformation = null; ActionInterceptorMatcher matcher1 = new FalseMatcher(); ActionInterceptorMatcher matcher2 = new TrueMatcher(); ActionInterceptorMatcher matcher3 = new TrueMatcher(); CompositeInterceptorMatcher compositeInterceptorMatcher = new CompositeInterceptorMatcher(LogicalOperation.NOT, matcher1, matcher2, matcher3); boolean result = compositeInterceptorMatcher.isInterceptorApplicable(actionInformation, MockActionInterceptor.class); assertTrue(result); }
@Test public void shouldInterceptorNotMatchWithNotOperator() throws Exception { ActionInformation actionInformation = null; ActionInterceptorMatcher matcher1 = new TrueMatcher(); ActionInterceptorMatcher matcher2 = new TrueMatcher(); ActionInterceptorMatcher matcher3 = new TrueMatcher(); CompositeInterceptorMatcher compositeInterceptorMatcher = new CompositeInterceptorMatcher(LogicalOperation.NOT, matcher1, matcher2, matcher3); boolean result = compositeInterceptorMatcher.isInterceptorApplicable(actionInformation, MockActionInterceptor.class); assertFalse(result); }