testFile("settings.gradle").writelns(
"include 'child'",
"project(':child').projectDir = rootProject.projectDir");
testFile("build.gradle").write("// empty");
ExecutionFailure result = inTestDirectory().withTasks("test").runWithFailure();
result.assertThatDescription(startsWith("Multiple projects in this build have project directory"));
result = usingProjectDir(getTestDirectory()).withTasks("test").runWithFailure();
result.assertThatDescription(startsWith("Multiple projects in this build have project directory"));
result = usingBuildFile(testFile("build.gradle")).withTasks("test").runWithFailure();
result.assertThatDescription(startsWith("Multiple projects in this build have build file"));
}