diff --git a/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/AccurestIntegrationSpec.groovy b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/AccurestIntegrationSpec.groovy new file mode 100644 index 0000000000..8454662519 --- /dev/null +++ b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/AccurestIntegrationSpec.groovy @@ -0,0 +1,29 @@ +package io.codearte.accurest.plugin + +import nebula.test.IntegrationSpec + +import java.nio.file.Files +import java.nio.file.Path + +import static java.nio.charset.StandardCharsets.UTF_8 +import static java.nio.charset.StandardCharsets.UTF_8 + +/** + * @author Olga Maciaszek-Sharma + @since 23.02.16 + */ +class AccurestIntegrationSpec extends IntegrationSpec{ + + public static final String SPOCK = "targetFramework = 'Spock'" + public static final String JUNIT = "targetFramework = 'JUnit'" + public static final String MVC_SPEC = "baseClassForTests = 'com.blogspot.toomuchcoding.MvcSpec'" + public static final String MVC_TEST = "baseClassForTests = 'com.blogspot.toomuchcoding.MvcTest'" + + protected void switchToJunitTestFramework() { + Path path = buildFile.toPath() + String content = new StringBuilder(new String(Files.readAllBytes(path), UTF_8)).replaceAll(SPOCK, JUNIT) + .replaceAll(MVC_SPEC, MVC_TEST) + Files.write(path, content.getBytes(UTF_8)) + } + +} diff --git a/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleJerseyProjectSpec.groovy b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleJerseyProjectSpec.groovy index 4c8c4026a1..d314e6c526 100755 --- a/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleJerseyProjectSpec.groovy +++ b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleJerseyProjectSpec.groovy @@ -1,20 +1,9 @@ package io.codearte.accurest.plugin -import nebula.test.IntegrationSpec import spock.lang.Stepwise -import java.nio.file.Files -import java.nio.file.Path - -import static java.nio.charset.StandardCharsets.UTF_8 - @Stepwise -class SampleJerseyProjectSpec extends IntegrationSpec { - - public static final String SPOCK = "targetFramework = 'Spock'" - public static final String JUNIT = "targetFramework = 'JUnit'" - public static final String MVC_SPEC = "baseClassForTests = 'com.blogspot.toomuchcoding.MvcSpec'" - public static final String MVC_TEST = "baseClassForTests = 'com.blogspot.toomuchcoding.MvcTest'" +class SampleJerseyProjectSpec extends AccurestIntegrationSpec { void setup() { copyResources("functionalTest/sampleJerseyProject", "") @@ -37,13 +26,4 @@ class SampleJerseyProjectSpec extends IntegrationSpec { runTasksSuccessfully('check') } - - private void switchToJunitTestFramework() { - Path path = buildFile.toPath() - String content = new StringBuilder(new String(Files.readAllBytes(path), UTF_8)).replaceAll(SPOCK, JUNIT) - .replaceAll(MVC_SPEC, MVC_TEST) - Files.write(path, content.getBytes(UTF_8)) - } - - } diff --git a/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleProjectSpec.groovy b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleProjectSpec.groovy index 9bb3c390f9..fefe2d9869 100755 --- a/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleProjectSpec.groovy +++ b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/SampleProjectSpec.groovy @@ -1,20 +1,9 @@ package io.codearte.accurest.plugin -import nebula.test.IntegrationSpec import spock.lang.Stepwise -import java.nio.file.Files -import java.nio.file.Path - -import static java.nio.charset.StandardCharsets.UTF_8 - @Stepwise -class SampleProjectSpec extends IntegrationSpec { - - public static final String SPOCK = "targetFramework = 'Spock'" - public static final String JUNIT = "targetFramework = 'JUnit'" - public static final String MVC_SPEC = "baseClassForTests = 'com.blogspot.toomuchcoding.MvcSpec'" - public static final String MVC_TEST = "baseClassForTests = 'com.blogspot.toomuchcoding.MvcTest'" +class SampleProjectSpec extends AccurestIntegrationSpec { void setup() { copyResources("functionalTest/sampleProject", "") @@ -36,12 +25,4 @@ class SampleProjectSpec extends IntegrationSpec { runTasksSuccessfully('check') } - - private void switchToJunitTestFramework() { - Path path = buildFile.toPath() - String content = new StringBuilder(new String(Files.readAllBytes(path), UTF_8)).replaceAll(SPOCK, JUNIT) - .replaceAll(MVC_SPEC, MVC_TEST) - Files.write(path, content.getBytes(UTF_8)) - } - }