}
@Test
public void matchingWithPatternSetReturnsUnionOfFilteredSets() {
final PatternSet patternSet = new PatternSet();
final FileTree filtered1 = context.mock(FileTree.class);
final FileTree filtered2 = context.mock(FileTree.class);
context.checking(new Expectations() {{
one(source1).matching(patternSet);
will(returnValue(filtered1));
one(source2).matching(patternSet);
will(returnValue(filtered2));
}});
FileTree filtered = tree.matching(patternSet);
assertThat(filtered, instanceOf(CompositeFileTree.class));
CompositeFileTree filteredCompositeSet = (CompositeFileTree) filtered;
assertThat(toList(filteredCompositeSet.getSourceCollections()), equalTo(toList((FileTree) filtered1, filtered2)));
}