Added missing code
This commit is contained in:
@@ -1583,7 +1583,7 @@ Spring Boot container if there is one.
|
||||
|
||||
https://projects.spring.io/spring-restdocs[Spring RestDocs] can be
|
||||
used to generate documentation (e.g. in asciidoctor format) for an
|
||||
HTTP API with Spring MockMvc or RestEasy. At the same time as you
|
||||
HTTP API with Spring MockMvc or Rest Assured. At the same time as you
|
||||
generate documentation for your API, you can also generate WireMock
|
||||
stubs, by using Spring Cloud Contract WireMock. Just write your normal
|
||||
RestDocs test cases and use `@AutoConfigureRestDocs` to have stubs
|
||||
|
||||
@@ -63,8 +63,8 @@ class StubRepository {
|
||||
}
|
||||
this.httpServerStubs = httpServerStubs;
|
||||
this.path = repository;
|
||||
this.stubs = stubs();
|
||||
this.options = options;
|
||||
this.stubs = stubs();
|
||||
this.contracts = contracts();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ class StubRepositorySpec extends Specification {
|
||||
|
||||
def 'should retrieve all descriptors for given project'() {
|
||||
given:
|
||||
StubRepository repository = new StubRepository(REPOSITORY_LOCATION, new StubRunnerOptionsBuilder().build())
|
||||
StubRepository repository = new StubRepository(REPOSITORY_LOCATION,
|
||||
[], new StubRunnerOptionsBuilder().build())
|
||||
int expectedDescriptorsSize = 8
|
||||
when:
|
||||
List<File> descriptors = repository.getStubs()
|
||||
@@ -34,7 +35,8 @@ class StubRepositorySpec extends Specification {
|
||||
|
||||
def 'should return empty list if files are missing'() {
|
||||
given:
|
||||
StubRepository repository = new StubRepository(new File('src/test/resources/emptyrepo'), new StubRunnerOptionsBuilder().build())
|
||||
StubRepository repository = new StubRepository(new File('src/test/resources/emptyrepo'),
|
||||
[], new StubRunnerOptionsBuilder().build())
|
||||
when:
|
||||
List<File> descriptors = repository.getStubs()
|
||||
then:
|
||||
@@ -43,7 +45,8 @@ class StubRepositorySpec extends Specification {
|
||||
|
||||
def 'should throw an exception if directory with mappings is missing'() {
|
||||
when:
|
||||
new StubRepository(new File('src/test/resources/nonexistingrepo'), new StubRunnerOptionsBuilder().build())
|
||||
new StubRepository(new File('src/test/resources/nonexistingrepo'), [],
|
||||
new StubRunnerOptionsBuilder().build())
|
||||
then:
|
||||
thrown(IllegalArgumentException)
|
||||
}
|
||||
@@ -51,12 +54,12 @@ class StubRepositorySpec extends Specification {
|
||||
def 'should retrieve only those mappings that contain the consumer name'() {
|
||||
given:
|
||||
StubRepository repository = new StubRepository(REPOSITORY_LOCATION,
|
||||
new StubRunnerOptionsBuilder()
|
||||
[], new StubRunnerOptionsBuilder()
|
||||
.withStubPerConsumer(true)
|
||||
.withConsumerName("ping").build())
|
||||
int expectedDescriptorsSize = 1
|
||||
when:
|
||||
List<WiremockMappingDescriptor> descriptors = repository.getProjectDescriptors()
|
||||
List<File> descriptors = repository.stubs
|
||||
then:
|
||||
descriptors.size() == expectedDescriptorsSize
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ class StubRunnerExecutorSpec extends Specification {
|
||||
|
||||
def setup() {
|
||||
portScanner = new AvailablePortScanner(MIN_PORT, MAX_PORT)
|
||||
repository = new StubRepository(new File('src/test/resources/repository'), new StubRunnerOptionsBuilder().build())
|
||||
repository = new StubRepository(new File('src/test/resources/repository'),
|
||||
[], new StubRunnerOptionsBuilder().build())
|
||||
}
|
||||
|
||||
def 'should provide URL for given relative path of stub'() {
|
||||
@@ -123,7 +124,7 @@ class StubRunnerExecutorSpec extends Specification {
|
||||
when:
|
||||
executor.runStubs(stubRunnerOptions,
|
||||
new StubRepository(new File('src/test/resources/repository/httpcontract'),
|
||||
new StubRunnerOptionsBuilder().build()), stubConf)
|
||||
[], new StubRunnerOptionsBuilder().build()), stubConf)
|
||||
then:
|
||||
!executor.trigger()
|
||||
!executor.trigger("missing", "label")
|
||||
@@ -139,7 +140,7 @@ class StubRunnerExecutorSpec extends Specification {
|
||||
when:
|
||||
RunningStubs stubs = executor.runStubs(stubRunnerOptions,
|
||||
new StubRepository(new File('src/test/resources/emptyrepo'),
|
||||
new StubRunnerOptionsBuilder().build()), stubConf)
|
||||
[], new StubRunnerOptionsBuilder().build()), stubConf)
|
||||
then:
|
||||
stubs.getPort('asd') == -1
|
||||
cleanup:
|
||||
|
||||
Reference in New Issue
Block a user