Search in sources :

Example 1 with MinimalFileSet

use of org.gradle.api.internal.file.collections.MinimalFileSet in project gradle by gradle.

the class CompositeFileCollectionTest method fileTreeIsLive.

@Test
public void fileTreeIsLive() {
    final File dir1 = new File("dir1");
    final File dir2 = new File("dir1");
    final File dir3 = new File("dir1");
    final MinimalFileSet source3 = context.mock(MinimalFileSet.class);
    FileTree fileTree = collection.getAsFileTree();
    assertThat(fileTree, instanceOf(CompositeFileTree.class));
    context.checking(new Expectations() {

        {
            oneOf(source1).getFiles();
            will(returnValue(toSet(dir1)));
            oneOf(source2).getFiles();
            will(returnValue(toSet(dir2)));
        }
    });
    ((CompositeFileTree) fileTree).getSourceCollections();
    collection.sourceCollections.add(source3);
    context.checking(new Expectations() {

        {
            oneOf(source1).getFiles();
            will(returnValue(toSet(dir1)));
            oneOf(source2).getFiles();
            will(returnValue(toSet(dir2)));
            oneOf(source3).getFiles();
            will(returnValue(toSet(dir3)));
        }
    });
    ((CompositeFileTree) fileTree).getSourceCollections();
}
Also used : Expectations(org.jmock.Expectations) FileTree(org.gradle.api.file.FileTree) DirectoryFileTree(org.gradle.api.internal.file.collections.DirectoryFileTree) MinimalFileSet(org.gradle.api.internal.file.collections.MinimalFileSet) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 FileTree (org.gradle.api.file.FileTree)1 DirectoryFileTree (org.gradle.api.internal.file.collections.DirectoryFileTree)1 MinimalFileSet (org.gradle.api.internal.file.collections.MinimalFileSet)1 Expectations (org.jmock.Expectations)1 Test (org.junit.Test)1