From 27895feb430c50e4d35cf57e19a1086e09682dc3 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 23 Feb 2017 10:58:45 +0000 Subject: [PATCH] Sync docs from 1.0.x to gh-pages --- 1.0.x/spring-cloud-contract.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/1.0.x/spring-cloud-contract.html b/1.0.x/spring-cloud-contract.html index 8ad444a5d4..9506d0a837 100644 --- a/1.0.x/spring-cloud-contract.html +++ b/1.0.x/spring-cloud-contract.html @@ -4600,7 +4600,9 @@ its methods as presented below:

@ContextConfiguration(classes = Config, loader = SpringBootContextLoader)
-@SpringBootTest(properties = [" stubrunner.cloud.enabled=false", "stubrunner.camel.enabled=false"])
+@SpringBootTest(properties = [" stubrunner.cloud.enabled=false",
+		"stubrunner.camel.enabled=false",
+		'foo=${stubrunner.runningstubs.fraudDetectionServer.port}'])
 @AutoConfigureStubRunner
 @DirtiesContext
 @ActiveProfiles("test")
@@ -4608,12 +4610,13 @@ class StubRunnerConfigurationSpec extends Specification {
 
 	@Autowired StubFinder stubFinder
 	@Autowired Environment environment
+	@Value('${foo}') Integer foo
 
 	@BeforeClass
 	@AfterClass
 	void setupProps() {
-		System.clearProperty("stubrunner.repository.root");
-		System.clearProperty("stubrunner.classifier");
+		System.clearProperty("stubrunner.repository.root")
+		System.clearProperty("stubrunner.classifier")
 	}
 
 	def 'should start WireMock servers'() {
@@ -4653,6 +4656,15 @@ class StubRunnerConfigurationSpec extends Specification {
 			stubFinder.findAllRunningStubs().getPort("fraudDetectionServer") == (environment.getProperty("stubrunner.runningstubs.fraudDetectionServer.port") as Integer)
 	}
 
+	def 'should be able to interpolate a running stub in the passed test property'() {
+		given:
+			int fraudPort = stubFinder.findAllRunningStubs().getPort("fraudDetectionServer")
+		expect:
+			fraudPort > 0
+			environment.getProperty("foo", Integer) == fraudPort
+			foo == fraudPort
+	}
+
 	@Configuration
 	@EnableAutoConfiguration
 	static class Config {}