Search in sources :

Example 1 with DefaultDirectoryFileTreeFactory

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

the class CompositeFileCollectionTest method getAsFileTreesReturnsUnionOfFileTrees.

@Test
public void getAsFileTreesReturnsUnionOfFileTrees() {
    final DirectoryFileTreeFactory directoryFileTreeFactory = new DefaultDirectoryFileTreeFactory();
    final DirectoryFileTree set1 = directoryFileTreeFactory.create(new File("dir1").getAbsoluteFile());
    final DirectoryFileTree set2 = directoryFileTreeFactory.create(new File("dir2").getAbsoluteFile());
    context.checking(new Expectations() {

        {
            oneOf(source1).getAsFileTrees();
            will(returnValue(toList((Object) set1)));
            oneOf(source2).getAsFileTrees();
            will(returnValue(toList((Object) set2)));
        }
    });
    assertThat(collection.getAsFileTrees(), equalTo((Collection) toList(set1, set2)));
}
Also used : Expectations(org.jmock.Expectations) DefaultDirectoryFileTreeFactory(org.gradle.api.internal.file.collections.DefaultDirectoryFileTreeFactory) DirectoryFileTreeFactory(org.gradle.api.internal.file.collections.DirectoryFileTreeFactory) DefaultDirectoryFileTreeFactory(org.gradle.api.internal.file.collections.DefaultDirectoryFileTreeFactory) FileCollection(org.gradle.api.file.FileCollection) Collection(java.util.Collection) DirectoryFileTree(org.gradle.api.internal.file.collections.DirectoryFileTree) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 Collection (java.util.Collection)1 FileCollection (org.gradle.api.file.FileCollection)1 DefaultDirectoryFileTreeFactory (org.gradle.api.internal.file.collections.DefaultDirectoryFileTreeFactory)1 DirectoryFileTree (org.gradle.api.internal.file.collections.DirectoryFileTree)1 DirectoryFileTreeFactory (org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)1 Expectations (org.jmock.Expectations)1 Test (org.junit.Test)1