Skip to content

Commit 86da56a

Browse files
committed
Revert disabling tests.
Signed-off-by: Olga Maciaszek-Sharma <[email protected]>
1 parent 3ea3d7a commit 86da56a

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package org.springframework.cloud.contract.stubrunner.spring.cloud
1919
import java.util.function.Function
2020

2121
import org.assertj.core.api.BDDAssertions
22-
import org.junit.jupiter.api.Disabled
2322
import org.junit.jupiter.api.Test
2423

2524
import org.springframework.beans.factory.annotation.Autowired
@@ -38,6 +37,7 @@ import org.springframework.core.env.Environment
3837
import org.springframework.http.ResponseEntity
3938
import org.springframework.messaging.Message
4039
import org.springframework.test.context.ActiveProfiles
40+
4141
/**
4242
* @author Marcin Grzejszczak
4343
*/
@@ -49,7 +49,6 @@ import org.springframework.test.context.ActiveProfiles
4949
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
5050
stubsPerConsumer = true)
5151
@ActiveProfiles("streamconsumer")
52-
@Disabled("TODO: Sth wrong with stream?")
5352
class StubRunnerStubsPerConsumerSpec {
5453
// end::test[]
5554

@@ -64,33 +63,37 @@ class StubRunnerStubsPerConsumerSpec {
6463
@Test
6564
void 'should start http stub servers for bar-consumer only'() {
6665
given:
67-
URL stubUrl = stubFinder.findStubUrl('producerWithMultipleConsumers')
66+
URL stubUrl = stubFinder.findStubUrl('producerWithMultipleConsumers')
6867
when:
69-
ResponseEntity entity = template.getForEntity("${stubUrl}/bar-consumer", String)
68+
ResponseEntity entity =
69+
template.getForEntity("${stubUrl}/bar-consumer", String)
7070
then:
71-
assert entity.statusCode.value() == 200
71+
assert entity.statusCode.value() == 200
7272
when:
73-
entity = template.getForEntity("${stubUrl}/foo-consumer", String)
73+
entity = template.getForEntity("${stubUrl}/foo-consumer", String)
7474
then:
75-
assert entity.statusCode.value() == 404
75+
assert entity.statusCode.value() == 404
7676
}
7777

7878
@Test
7979
void 'should trigger a message by label from proper consumer'() {
8080
when:
81-
stubFinder.trigger('return_book_for_bar')
81+
stubFinder.trigger('return_book_for_bar')
8282
then:
83-
Message<?> receivedMessage = messaging.receive('output')
83+
Message<?> receivedMessage = messaging.receive('output')
8484
and:
85-
assert receivedMessage != null
86-
assert receivedMessage.payload == '''{"bookName":"foo_for_bar"}'''.bytes
87-
assert receivedMessage.headers.get('BOOK-NAME') == 'foo_for_bar'
85+
assert receivedMessage != null
86+
assert receivedMessage.payload == '''{"bookName":"foo_for_bar"}'''.bytes
87+
assert receivedMessage.headers.get('BOOK-NAME') == 'foo_for_bar'
8888
}
8989

9090
@Test
9191
void 'should not trigger a message by the not matching consumer'() {
9292
when:
93-
BDDAssertions.thenThrownBy(() -> stubFinder.trigger('return_book_for_foo')).isInstanceOf(IllegalArgumentException).hasMessageContaining("No label with name [return_book_for_foo] was found")
93+
BDDAssertions
94+
.thenThrownBy(() -> stubFinder.trigger('return_book_for_foo'))
95+
.isInstanceOf(IllegalArgumentException)
96+
.hasMessageContaining("No label with name [return_book_for_foo] was found")
9497
}
9598

9699
@Configuration

spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package org.springframework.cloud.contract.stubrunner.spring.cloud
1919
import java.util.function.Function
2020

2121
import org.assertj.core.api.BDDAssertions
22-
import org.junit.jupiter.api.Disabled
2322
import org.junit.jupiter.api.Test
2423

2524
import org.springframework.beans.factory.annotation.Autowired
@@ -38,18 +37,18 @@ import org.springframework.core.env.Environment
3837
import org.springframework.http.ResponseEntity
3938
import org.springframework.messaging.Message
4039
import org.springframework.test.context.ActiveProfiles
40+
4141
/**
4242
* @author Marcin Grzejszczak
4343
*/
4444
// tag::test[]
4545
@SpringBootTest(classes = Config, properties = "stubrunner.jms.enabled=false")
4646
@AutoConfigureStubRunner(ids = "org.springframework.cloud.contract.verifier.stubs:producerWithMultipleConsumers",
47-
repositoryRoot = "classpath:m2repo/repository/",
48-
consumerName = "foo-consumer",
49-
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
50-
stubsPerConsumer = true)
47+
repositoryRoot = "classpath:m2repo/repository/",
48+
consumerName = "foo-consumer",
49+
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
50+
stubsPerConsumer = true)
5151
@ActiveProfiles("streamconsumer")
52-
@Disabled("TODO: Sth wrong with stream?")
5352
class StubRunnerStubsPerConsumerWithConsumerNameSpec {
5453
// end::test[]
5554

@@ -67,7 +66,8 @@ class StubRunnerStubsPerConsumerWithConsumerNameSpec {
6766
given:
6867
URL stubUrl = stubFinder.findStubUrl('producerWithMultipleConsumers')
6968
when:
70-
ResponseEntity entity = template.getForEntity("${stubUrl}/foo-consumer", String)
69+
ResponseEntity entity =
70+
template.getForEntity("${stubUrl}/foo-consumer", String)
7171
then:
7272
assert entity.statusCode.value() == 200
7373
when:
@@ -91,8 +91,10 @@ class StubRunnerStubsPerConsumerWithConsumerNameSpec {
9191
@Test
9292
void 'should not trigger a message by the not matching consumer'() {
9393
when:
94-
BDDAssertions.thenThrownBy(() -> stubFinder.trigger('return_book_for_bar')).isInstanceOf(IllegalArgumentException)
95-
.hasMessageContaining("No label with name [return_book_for_bar] was found")
94+
BDDAssertions
95+
.thenThrownBy(() -> stubFinder.trigger('return_book_for_bar'))
96+
.isInstanceOf(IllegalArgumentException)
97+
.hasMessageContaining("No label with name [return_book_for_bar] was found")
9698
}
9799

98100
@Configuration
@@ -101,7 +103,7 @@ class StubRunnerStubsPerConsumerWithConsumerNameSpec {
101103
static class Config {
102104
@Bean
103105
Function output() {
104-
return { Object o ->
106+
return { Object o ->
105107
println(o)
106108
return o
107109
}

0 commit comments

Comments
 (0)