Added an option to use Rest Assured version 3.0

without this change it's impossible to use Rest Assured 3.0 with Spring Cloud Contract. That's because we are adding Rest Assured 2.0 imports.
with this change we detect Rest Assured version. If 3.0 is available on the classpath we change the imports

fixes #266
This commit is contained in:
Marcin Grzejszczak
2017-04-14 15:31:22 +02:00
parent 28885c1459
commit 2ce4b2e67c
12 changed files with 285 additions and 496 deletions

View File

@@ -16,11 +16,14 @@
package com.example.source;
import io.restassured.module.mockmvc.RestAssuredMockMvc;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.verifier.messaging.boot.AutoConfigureMessageVerifier;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.context.WebApplicationContext;
/**
* Base class for sensor autogenerated tests (used by Spring Cloud Contract).
@@ -37,6 +40,14 @@ public abstract class SensorSourceTestBase {
@Autowired
ContractVerifierSampleStreamSourceApplication application;
@Autowired
WebApplicationContext context;
@Before
public void setup() {
RestAssuredMockMvc.webAppContextSetup(this.context);
}
public void createSensorData() {
application.poll();
}

View File

@@ -0,0 +1,11 @@
package contracts
org.springframework.cloud.contract.spec.Contract.make {
request {
method(GET())
url("/health")
}
response {
status(200)
}
}