CompositeMatcher implements Matcher { public static Matcher compose(List<Matcher> matchers){ switch (matchers.size()) { case 0: return Matcher.NON_MATCHING; case 1: return matchers.get(0); default: return new CompositeMatcher(matchers); } } private  CompositeMatcher(List<Matcher> matchers); static Matcher compose(List<Matcher> matchers); @Override Matcher next(String name); @Override boolean isMatch(); @Override String getMatchedPath(); @Override int depth(); @Override boolean matchesAllChildren();  }
@Test(expected = IllegalArgumentException.class) public void multiWithFailing() throws Exception{ CompositeMatcher.compose(asList(new Include("x").createMatcher(), Matcher.NON_MATCHING)); }