Added AccurestIntegrationSpec.

This commit is contained in:
Olga Maciaszek-Sharma
2016-02-23 20:56:10 +01:00
parent 8279dceb65
commit 8f61701d7d
3 changed files with 31 additions and 41 deletions

View File

@@ -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))
}
}

View File

@@ -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))
}
}

View File

@@ -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))
}
}