From 8fa57f5832b11d7fc194f1e8318d10375d07e50b Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 15 Mar 2018 16:43:32 +0100 Subject: [PATCH] Added additional tests --- .../StubRunnerOptionsBuilderSpec.groovy | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy index 60b0fedae6..977635db4a 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy @@ -36,16 +36,52 @@ class StubRunnerOptionsBuilderSpec extends Specification { options.getDependencies().toString() == '[foo:bar:+:stubs]' } - def shouldCreateDependenciesForCommaSeparatedStubs() { + def shouldCreateDependenciesForMultipleStubsWithSameGroup() { given: - builder.withStubs('foo:bar,bar:foo') + builder.withStubs('foo:bar', 'foo:baz', 'foo:baz2') when: StubRunnerOptions options = builder.build() then: - options.getDependencies().size() == 2 + options.getDependencies().toString() == '[foo:bar:+:stubs, foo:baz:+:stubs, foo:baz2:+:stubs]' + } + + def shouldCreateDependenciesForMultipleStubsWithSameArtifactId() { + + given: + builder.withStubs('bar:foo', 'baz:foo', 'baz2:foo') + + when: + StubRunnerOptions options = builder.build() + + then: + options.getDependencies().toString() == '[bar:foo:+:stubs, baz:foo:+:stubs, baz2:foo:+:stubs]' + } + + def shouldCreateDependenciesForCommaSeparatedStubs() { + + given: + builder.withStubs('foo:bar,bar:foo,foo:baz') + + when: + StubRunnerOptions options = builder.build() + + then: + options.getDependencies().size() == 3 + } + + def shouldCreateDependenciesForCommaSeparatedStubsWithSameArtifact() { + + given: + builder.withStubs('bar:foo,baz:foo,baz2:foo') + + when: + StubRunnerOptions options = builder.build() + + then: + options.getDependencies().toString() == '[bar:foo:+:stubs, baz:foo:+:stubs, baz2:foo:+:stubs]' } def shouldMapStubsWithPort() {