Search in sources :

Example 1 with IntegrationTestBuildContext

use of org.gradle.integtests.fixtures.executer.IntegrationTestBuildContext in project gradle by gradle.

the class Sample method apply.

public Statement apply(final Statement base, FrameworkMethod method, Object target) {
    sampleName = getSampleName(method);
    return new Statement() {

        @Override
        public void evaluate() throws Throwable {
            if (sampleName != null) {
                String hintForMissingSample = String.format("If '%s' is a new sample, try running 'gradle intTestImage'.", sampleName);
                TestFile srcDir = new IntegrationTestBuildContext().getSamplesDir().file(sampleName).assertIsDir(hintForMissingSample);
                logger.debug("Copying sample '{}' to test directory.", sampleName);
                srcDir.copyTo(getDir());
            } else {
                logger.debug("No sample specified for this test, skipping.");
            }
            base.evaluate();
        }
    };
}
Also used : Statement(org.junit.runners.model.Statement) TestFile(org.gradle.test.fixtures.file.TestFile) IntegrationTestBuildContext(org.gradle.integtests.fixtures.executer.IntegrationTestBuildContext)

Aggregations

IntegrationTestBuildContext (org.gradle.integtests.fixtures.executer.IntegrationTestBuildContext)1 TestFile (org.gradle.test.fixtures.file.TestFile)1 Statement (org.junit.runners.model.Statement)1