diff --git a/subprojects/plugins/src/test/groovy/org/gradle/api/internal/tasks/DefaultSourceSetTest.groovy b/subprojects/plugins/src/test/groovy/org/gradle/api/internal/tasks/DefaultSourceSetTest.groovy
index c623e6f..f419a5a 100644
--- a/subprojects/plugins/src/test/groovy/org/gradle/api/internal/tasks/DefaultSourceSetTest.groovy
+++ b/subprojects/plugins/src/test/groovy/org/gradle/api/internal/tasks/DefaultSourceSetTest.groovy
@@ -19,12 +19,20 @@ import org.gradle.api.Task
 import org.gradle.api.internal.file.DefaultSourceDirectorySet
 import org.gradle.api.internal.file.FileResolver
 import org.gradle.api.tasks.SourceSet
+import org.gradle.util.GFileUtils
+import org.gradle.util.TemporaryFolder
+import org.gradle.util.TestFile
+import org.junit.Rule
 import org.junit.Test
+
 import static org.gradle.util.Matchers.isEmpty
 import static org.hamcrest.Matchers.*
 import static org.junit.Assert.assertThat
 
 class DefaultSourceSetTest {
+    @Rule
+    public final TemporaryFolder tmpDir = new TemporaryFolder()
+    private final TestFile testDir = tmpDir.dir
     private final FileResolver fileResolver = [resolve: {it as File}] as FileResolver
     private final TaskResolver taskResolver = [resolveTask: {name -> [getName: {name}] as Task}] as TaskResolver
 
@@ -147,4 +155,90 @@ class DefaultSourceSetTest {
         sourceSet.compiledBy('a', 'b')
         assertThat(sourceSet.output.buildDependencies.getDependencies(null)*.name as Set, equalTo(['a', 'b'] as Set))
     }
+
+    @Test
+    public void getAllSourceDifferentDirectoriesNoIncludes() {
+        File srcDir1 = new File(testDir, 'src/main/java')
+        File javaFile = new File(srcDir1, 'Test.java')
+        GFileUtils.touch(javaFile)
+        File srcDir2 = new File(testDir, 'src/main/test')
+        File propertiesFile = new File(srcDir2, 'test.properties')
+        GFileUtils.touch(propertiesFile)
+
+        SourceSet sourceSet = sourceSet('set-name')
+        sourceSet.java {
+            srcDir  srcDir1
+        }
+        sourceSet.resources {
+            srcDir  srcDir2
+        }
+        assertThat(sourceSet.allJava   as Set, equalTo([javaFile] as Set))
+        assertThat(sourceSet.resources as Set, equalTo([propertiesFile] as Set))
+        assertThat(sourceSet.allSource as Set, equalTo([javaFile, propertiesFile] as Set))
+    }
+
+    @Test
+    public void getAllSourceDifferentDirectoriesWithIncludes() {
+        File srcDir1 = new File(testDir, 'src/main/java')
+        File javaFile = new File(srcDir1, 'Test.java')
+        GFileUtils.touch(javaFile)
+        File srcDir2 = new File(testDir, 'src/main/test')
+        File propertiesFile = new File(srcDir2, 'test.properties')
+        GFileUtils.touch(propertiesFile)
+
+        SourceSet sourceSet = sourceSet('set-name')
+        sourceSet.java {
+            srcDir  srcDir1
+            include '**/*.java'
+        }
+        sourceSet.resources {
+            srcDir  srcDir2
+            include '**/*.properties'
+        }
+        assertThat(sourceSet.allJava   as Set, equalTo([javaFile] as Set))
+        assertThat(sourceSet.resources as Set, equalTo([propertiesFile] as Set))
+        assertThat(sourceSet.allSource as Set, equalTo([javaFile, propertiesFile] as Set))
+    }
+
+    @Test
+    public void getAllSourceSameDirectoryNoIncludes() {
+        File srcDir1 = new File(testDir, 'src/main')
+        File javaFile = new File(srcDir1, 'Test.java')
+        GFileUtils.touch(javaFile)
+        File propertiesFile = new File(srcDir1, 'test.properties')
+        GFileUtils.touch(propertiesFile)
+
+        SourceSet sourceSet = sourceSet('set-name')
+        sourceSet.java {
+            srcDir  srcDir1
+        }
+        sourceSet.resources {
+            srcDir  srcDir1
+        }
+        assertThat(sourceSet.allJava   as Set, equalTo([javaFile] as Set))
+        assertThat(sourceSet.resources as Set, equalTo([propertiesFile] as Set))
+        assertThat(sourceSet.allSource as Set, equalTo([javaFile, propertiesFile] as Set))
+    }
+
+    @Test
+    public void getAllSourceSameDirectoryWithIncludes() {
+        File srcDir1 = new File(testDir, 'src/main')
+        File javaFile = new File(srcDir1, 'Test.java')
+        GFileUtils.touch(javaFile)
+        File propertiesFile = new File(srcDir1, 'test.properties')
+        GFileUtils.touch(propertiesFile)
+
+        SourceSet sourceSet = sourceSet('set-name')
+        sourceSet.java {
+            srcDir  srcDir1
+            include '**/*.java'
+        }
+        sourceSet.resources {
+            srcDir  srcDir1
+            include '**/*.properties'
+        }
+        assertThat(sourceSet.allJava   as Set, equalTo([javaFile] as Set))
+        assertThat(sourceSet.resources as Set, equalTo([propertiesFile] as Set))
+        assertThat(sourceSet.allSource as Set, equalTo([javaFile, propertiesFile] as Set))
+    }
 }
