diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/ContractProjectUpdaterTest.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/ContractProjectUpdaterTest.java index 6bd0380d3f..7cf6e526cc 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/ContractProjectUpdaterTest.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/ContractProjectUpdaterTest.java @@ -46,6 +46,7 @@ public class ContractProjectUpdaterTest extends AbstractGitTest { this.gitRepo = new GitRepo(this.tmpFolder); this.origin = clonedProject(this.tmp.newFolder(), this.originalProject); this.project = this.gitRepo.cloneProject(this.originalProject.toURI()); + this.gitRepo.checkout(this.project, "master"); setOriginOnProjectToTmp(this.origin, this.project, true); StubRunnerOptions options = new StubRunnerOptionsBuilder() .withStubRepositoryRoot("file://" + this.project.getAbsolutePath() + "/") diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitStubDownloaderTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitStubDownloaderTests.java index bda2abe724..80b1e1033b 100644 --- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitStubDownloaderTests.java +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitStubDownloaderTests.java @@ -17,6 +17,7 @@ package org.springframework.cloud.contract.stubrunner; import java.io.File; import java.net.URISyntaxException; +import java.util.HashMap; import java.util.Map; import org.junit.Before; @@ -46,6 +47,7 @@ public class GitStubDownloaderTests { StubDownloader stubDownloader = stubDownloaderBuilder.build(new StubRunnerOptionsBuilder() .withStubsMode(StubRunnerProperties.StubsMode.CLASSPATH) + .withProperties(props()) .build()); then(stubDownloader).isNull(); @@ -57,6 +59,7 @@ public class GitStubDownloaderTests { StubDownloader stubDownloader = stubDownloaderBuilder.build(new StubRunnerOptionsBuilder() .withStubsMode(StubRunnerProperties.StubsMode.REMOTE) + .withProperties(props()) .build()); then(stubDownloader).isNull(); @@ -69,6 +72,7 @@ public class GitStubDownloaderTests { StubDownloader stubDownloader = stubDownloaderBuilder.build(new StubRunnerOptionsBuilder() .withStubsMode(StubRunnerProperties.StubsMode.REMOTE) .withStubRepositoryRoot("http://foo.com") + .withProperties(props()) .build()); then(stubDownloader).isNull(); @@ -80,6 +84,7 @@ public class GitStubDownloaderTests { StubDownloader stubDownloader = stubDownloaderBuilder.build(new StubRunnerOptionsBuilder() .withStubsMode(StubRunnerProperties.StubsMode.REMOTE) .withStubRepositoryRoot("git://" + file("/git_samples/contract-git/").getAbsolutePath() + "/") + .withProperties(props()) .build()); Map.Entry entry = stubDownloader @@ -96,6 +101,7 @@ public class GitStubDownloaderTests { StubDownloader stubDownloader = stubDownloaderBuilder.build(new StubRunnerOptionsBuilder() .withStubsMode(StubRunnerProperties.StubsMode.REMOTE) .withStubRepositoryRoot("git://" + file("/git_samples/contract-git").getAbsolutePath()) + .withProperties(props()) .build()); try { @@ -113,6 +119,7 @@ public class GitStubDownloaderTests { StubDownloader stubDownloader = stubDownloaderBuilder.build(new StubRunnerOptionsBuilder() .withStubsMode(StubRunnerProperties.StubsMode.REMOTE) .withStubRepositoryRoot("git://" + file("/git_samples/contract-git").getAbsolutePath()) + .withProperties(props()) .build()); try { @@ -123,6 +130,12 @@ public class GitStubDownloaderTests { } } + private Map props() { + Map map = new HashMap<>(); + map.put("git.branch", "master"); + return map; + } + private File file(String relativePath) throws URISyntaxException { return new File(GitStubDownloaderTests.class.getResource(relativePath).toURI()); }