Fixed(?) stub runner tests (?)

This commit is contained in:
Marcin Grzejszczak
2016-04-05 14:08:34 +02:00
parent dad6c55998
commit 8eb0b5956a
3 changed files with 26 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
package io.codearte.accurest.stubrunner.junit;
import org.apache.commons.io.IOUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
@@ -14,6 +16,13 @@ import static org.assertj.core.api.BDDAssertions.then;
*/
public class AccurestRuleJUnitTest {
@BeforeClass
@AfterClass
public static void setupProps() {
System.getProperties().setProperty("stubrunner.stubs.repository.root", "");
System.getProperties().setProperty("stubrunner.stubs.classifier", "stubs");
}
@ClassRule public static AccurestRule rule = new AccurestRule()
.repoRoot(repoRoot())
.downloadStub("io.codearte.accurest.stubs", "loanIssuance")

View File

@@ -1,5 +1,7 @@
package io.codearte.accurest.stubrunner.junit
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.ClassRule
import spock.lang.Shared
import spock.lang.Specification
@@ -9,9 +11,11 @@ import spock.lang.Specification
*/
class AccurestRuleSpec extends Specification {
static {
System.properties.setProperty("stubrunner.stubs.repository.root", "")
System.properties.setProperty("stubrunner.stubs.classifier", 'stubs')
@BeforeClass
@AfterClass
void setupProps() {
System.getProperties().setProperty("stubrunner.stubs.repository.root", "");
System.getProperties().setProperty("stubrunner.stubs.classifier", "stubs");
}
@ClassRule @Shared AccurestRule rule = new AccurestRule()

View File

@@ -1,21 +1,28 @@
package io.codearte.accurest.stubrunner.junit
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.ClassRule
import spock.lang.Shared
import spock.lang.Specification
import spock.util.environment.RestoreSystemProperties
/**
* @author Marcin Grzejszczak
*/
@RestoreSystemProperties
class AccurestRuleSysPropsSpec extends Specification {
static {
@BeforeClass
void setProps() {
System.properties.setProperty("stubrunner.stubs.repository.root", AccurestRuleSysPropsSpec.getResource("/m2repo").toURI().toString())
System.properties.setProperty("stubrunner.stubs.classifier", 'classifier that will be overridden')
}
@AfterClass
void cleanupProps() {
System.getProperties().setProperty("stubrunner.stubs.repository.root", "");
System.getProperties().setProperty("stubrunner.stubs.classifier", "stubs");
}
@ClassRule @Shared AccurestRule rule = new AccurestRule()
.downloadStub("io.codearte.accurest.stubs", "loanIssuance", "stubs")
.downloadStub("io.codearte.accurest.stubs:fraudDetectionServer:stubs")