Search in sources :

Example 6 with FileCollectionInternal

use of org.gradle.api.internal.file.FileCollectionInternal in project gradle by gradle.

the class DefaultConfigurableFileCollectionTest method canUseAFileCollectionToSpecifyTheContentsOfTheCollection.

@Test
public void canUseAFileCollectionToSpecifyTheContentsOfTheCollection() {
    final File file1 = new File("1");
    final File file2 = new File("2");
    final FileCollectionInternal src = context.mock(FileCollectionInternal.class);
    collection.from(src);
    context.checking(new Expectations() {

        {
            oneOf(src).getFiles();
            will(returnValue(toLinkedSet(file1)));
        }
    });
    assertThat(collection.getFiles(), equalTo(toLinkedSet(file1)));
    context.checking(new Expectations() {

        {
            oneOf(src).getFiles();
            will(returnValue(toLinkedSet(file1, file2)));
        }
    });
    assertThat(collection.getFiles(), equalTo(toLinkedSet(file1, file2)));
}
Also used : Expectations(org.jmock.Expectations) FileCollectionInternal(org.gradle.api.internal.file.FileCollectionInternal) File(java.io.File) Test(org.junit.Test)

Aggregations

FileCollectionInternal (org.gradle.api.internal.file.FileCollectionInternal)6 File (java.io.File)3 TaskDependency (org.gradle.api.tasks.TaskDependency)2 Expectations (org.jmock.Expectations)2 Test (org.junit.Test)2 Set (java.util.Set)1 Task (org.gradle.api.Task)1 Dependency (org.gradle.api.artifacts.Dependency)1 FileCollectionDependency (org.gradle.api.artifacts.FileCollectionDependency)1 SelfResolvingDependency (org.gradle.api.artifacts.SelfResolvingDependency)1 TaskInputsListener (org.gradle.api.execution.internal.TaskInputsListener)1 FileCollection (org.gradle.api.file.FileCollection)1 TaskInternal (org.gradle.api.internal.TaskInternal)1 DefaultSelfResolvingDependency (org.gradle.api.internal.artifacts.dependencies.DefaultSelfResolvingDependency)1 AbstractFileCollection (org.gradle.api.internal.file.AbstractFileCollection)1 FileSystemSubset (org.gradle.api.internal.file.FileSystemSubset)1 AbstractTaskDependency (org.gradle.api.internal.tasks.AbstractTaskDependency)1 OpaqueComponentIdentifier (org.gradle.internal.component.local.model.OpaqueComponentIdentifier)1