Ejemplo n.º 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();
  }
Ejemplo n.º 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();
  }
Ejemplo n.º 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.");
  }