Package org.gradle.util

Examples of org.gradle.util.TestFile


        failure.assertHasCause("Compile failed; see the compiler error output for details.");
    }

    @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();
    }
View Full Code Here


        usingBuildFile(buildFile).withTasks("build").run();
    }

    @Test
    public void javadocGenerationFailureBreaksBuild() throws IOException {
        TestFile buildFile = testFile("javadocs.gradle");
        buildFile.write("apply plugin: 'java'");
        testFile("src/main/java/org/gradle/broken.java").write("class Broken { }");

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

        failure.assertHasFileName(String.format("Build file '%s'", buildFile));
View Full Code Here

        failure.assertHasCause("Javadoc generation failed.");
    }

    @Test
    public void handlesResourceOnlyProject() throws IOException {
        TestFile buildFile = testFile("resources.gradle");
        buildFile.write("apply plugin: 'java'");
        testFile("src/main/resources/org/gradle/resource.file").write("test resource");

        usingBuildFile(buildFile).withTasks("build").run();
        testFile("build/classes/main/org/gradle/resource.file").assertExists();
    }
View Full Code Here

    }

    @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");
View Full Code Here

import org.junit.Test;

public class WebProjectIntegrationTest extends AbstractIntegrationTest {
    @Test
    public void handlesEmptyProject() {
        TestFile buildFile = testFile("build.gradle");
        buildFile.writelns(
                "apply plugin: 'war'"
        );

        usingBuildFile(buildFile).withTasks("build").run();
    }
View Full Code Here

    }

    @Test
    public void createsAWar() {
        testFile("settings.gradle").writelns("rootProject.name = 'test'");
        TestFile buildFile = testFile("build.gradle");
        buildFile.writelns(
                "apply plugin: 'war'"
        );
        testFile("src/main/webapp/index.jsp").write("<p>hi</p>");

        usingBuildFile(buildFile).withTasks("assemble").run();
View Full Code Here

    }

    @Test
    public void canCustomiseArchiveNamesUsingConventionProperties() {
        testFile("settings.gradle").writelns("rootProject.name = 'test'");
        TestFile buildFile = testFile("build.gradle");
        buildFile.writelns(
                "apply plugin: 'war'",
                "jar.enabled = true",
                "buildDirName = 'output'",
                "libsDirName = 'archives'",
                "archivesBaseName = 'test'",
View Full Code Here

    }

    @Test
    public void generatesArtifactsWhenVersionIsEmpty() {
        testFile("settings.gradle").write("rootProject.name = 'empty'");
        TestFile buildFile = testFile("build.gradle");
        buildFile.writelns(
                "apply plugin: 'war'",
                "jar.enabled = true",
                "version = ''"
        );
        testFile("src/main/resources/org/gradle/resource.file").write("some resource");
View Full Code Here

import static org.hamcrest.Matchers.*;

public class ProjectLoadingIntegrationTest extends AbstractIntegrationTest {
    @Test
    public void handlesSimilarlyNamedBuildFilesInSameDirectory() {
        TestFile buildFile1 = testFile("similarly-named build.gradle").write("task build");
        TestFile buildFile2 = testFile("similarly_named_build_gradle").write("task 'other-build'");

        usingBuildFile(buildFile1).withTasks("build").run();

        usingBuildFile(buildFile2).withTasks("other-build").run();

View Full Code Here

    @Test
    public void canDetermineRootProjectAndDefaultProjectBasedOnBuildFile() {
        testFile("settings.gradle").write("include('child')");

        TestFile rootBuildFile = testFile("build.gradle");
        rootBuildFile.write("task('do-stuff')");

        TestFile childBuildFile = testFile("child/build.gradle");
        childBuildFile.write("task('do-stuff')");

        usingBuildFile(rootBuildFile).withSearchUpwards().withTasks("do-stuff").run().assertTasksExecuted(":do-stuff", ":child:do-stuff");
        usingBuildFile(rootBuildFile).withSearchUpwards().withTasks(":do-stuff").run().assertTasksExecuted(":do-stuff");

        usingBuildFile(childBuildFile).withSearchUpwards().withTasks("do-stuff").run().assertTasksExecuted(":child:do-stuff");
View Full Code Here

TOP

Related Classes of org.gradle.util.TestFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.