Пример #1
0
  @Test
  public void handlesTestSrcWhichDoesNotContainAnyTestCases() {
    TestFile buildFile = testFile("build.gradle");
    buildFile.writelns("apply plugin: 'java'");
    testFile("src/test/java/org/gradle/NotATest.java")
        .writelns("package org.gradle;", "public class NotATest {}");

    usingBuildFile(buildFile).withTasks("build").run();
  }
Пример #2
0
  @Test
  public void generatesArtifactsWhenVersionIsEmpty() {
    testFile("settings.gradle").write("rootProject.name = 'empty'");
    TestFile buildFile = testFile("build.gradle");
    buildFile.writelns("apply plugin: 'java'", "version = ''");
    testFile("src/main/resources/org/gradle/resource.file").write("some resource");

    usingBuildFile(buildFile).withTasks("jar").run();
    testFile("build/libs/empty.jar").assertIsFile();
  }
Пример #3
0
  @Test
  public void compilationFailureBreaksBuild() {
    TestFile buildFile = testFile("build.gradle");
    buildFile.writelns("apply plugin: 'java'");
    testFile("src/main/java/org/gradle/broken.java").write("broken");

    ExecutionFailure failure = usingBuildFile(buildFile).withTasks("build").runWithFailure();

    failure.assertHasFileName(String.format("Build file '%s'", buildFile));
    failure.assertHasDescription("Execution failed for task ':compileJava'");
    failure.assertHasCause("Compile failed; see the compiler error output for details.");
  }