use of org.gradle.testkit.runner.BuildResult in project byte-buddy by raphw.
the class ByteBuddyPluginTest method makePluginJar.
private static File makePluginJar() throws IOException {
File pluginFolder = TEMPORARY_FOLDER.newFolder("test-byte-buddy-plugin");
store("plugins { id 'java' }\n" + "repositories {\n" + " mavenLocal()\n" + " mavenCentral()\n" + "}\n" + "dependencies {\n" + " compile 'net.bytebuddy:byte-buddy:" + BYTE_BUDDY_VERSION + "'\n" + "}\n", new File(pluginFolder, "build.gradle"));
File pluginRoot = new File(pluginFolder, "src/main/java/net/bytebuddy/test");
assertThat(pluginRoot.mkdirs(), is(true));
store("package net.bytebuddy.test;\n" + "\n" + "import net.bytebuddy.build.Plugin;\n" + "import net.bytebuddy.description.type.TypeDescription;\n" + "import net.bytebuddy.dynamic.DynamicType;\n" + "import net.bytebuddy.implementation.FixedValue;\n" + "\n" + "import static net.bytebuddy.matcher.ElementMatchers.named;\n" + "\n" + "public class SimplePlugin implements Plugin {\n" + " @Override\n" + " public boolean matches(TypeDescription target) {\n" + " return target.getName().equals(\"net.bytebuddy.test.Sample\");\n" + " }\n" + " @Override\n" + " public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription) {\n" + " return builder.method(named(\"foo\")).intercept(FixedValue.value(\"qux\"));\n" + " }\n" + "}\n", new File(pluginRoot, "SimplePlugin.java"));
BuildResult result = GradleRunner.create().withProjectDir(pluginFolder).withArguments("jar").build();
assertThat(result.task(":jar").getOutcome(), is(TaskOutcome.SUCCESS));
return new File(pluginFolder, "build/libs/test-byte-buddy-plugin.jar");
}
use of org.gradle.testkit.runner.BuildResult in project lightning by automatictester.
the class GradleCompatibilityTest method checkGradleCompatibility.
@Test(dataProvider = "getGradleVersions")
public void checkGradleCompatibility(String gradleVersion) {
BuildResult result = GradleRunner.create().withGradleVersion(gradleVersion).withProjectDir(new File("src/integrationTest/resources/build/complete")).withArguments(":report").withPluginClasspath().build();
assertThat(result.task(":report").getOutcome(), is(SUCCESS));
}
use of org.gradle.testkit.runner.BuildResult in project lightning by automatictester.
the class ReportTaskTest method runReport.
@Test
public void runReport() {
BuildResult result = GradleRunner.create().withProjectDir(new File("src/integrationTest/resources/build/complete")).withArguments(":report").withPluginClasspath().build();
assertThat(result.task(":report").getOutcome(), is(SUCCESS));
assertThat(taskOutputContainsFileContent("/results/expected/report.txt", result), is(true));
}
use of org.gradle.testkit.runner.BuildResult in project lightning by automatictester.
the class VerifyTaskTest method runVerifyAndCheckJUnitReport.
@Test
public void runVerifyAndCheckJUnitReport() throws IOException {
BuildResult result = GradleRunner.create().withProjectDir(new File("src/integrationTest/resources/build/junit")).withArguments(":verify").withPluginClasspath().buildAndFail();
assertThat(result.task(":verify").getOutcome(), is(FAILED));
assertThat(fileContentIsEqual("/results/expected/junit-expected.xml", "junit.xml"), is(true));
}
use of org.gradle.testkit.runner.BuildResult in project lightning by automatictester.
the class VerifyTaskTest method runVerifyWithFailureAndError.
@Test
public void runVerifyWithFailureAndError() {
BuildResult result = GradleRunner.create().withProjectDir(new File("src/integrationTest/resources/build/1_1_1")).withArguments(":verify").withPluginClasspath().buildAndFail();
assertThat(result.task(":verify").getOutcome(), is(FAILED));
assertThat(taskOutputContainsFileContent("/results/expected/1_1_1.txt", result), is(true));
}
Aggregations