diff --git a/accurest-core/src/main/groovy/io/codearte/accurest/builder/ClassBuilder.groovy b/accurest-core/src/main/groovy/io/codearte/accurest/builder/ClassBuilder.groovy index 459bf57a4c..b24c5b57ec 100644 --- a/accurest-core/src/main/groovy/io/codearte/accurest/builder/ClassBuilder.groovy +++ b/accurest-core/src/main/groovy/io/codearte/accurest/builder/ClassBuilder.groovy @@ -123,12 +123,14 @@ class ClassBuilder { clazz.addEmptyLine() } + clazz.startBlock() fields.sort().each { clazz.addLine(it) } if (!fields.empty) { clazz.addEmptyLine() } + clazz.endBlock() methods.each { clazz.addBlock(it) diff --git a/accurest-core/src/main/groovy/io/codearte/accurest/builder/JUnitMessagingMethodBodyBuilder.groovy b/accurest-core/src/main/groovy/io/codearte/accurest/builder/JUnitMessagingMethodBodyBuilder.groovy index 11228c64e2..62f96f3fab 100644 --- a/accurest-core/src/main/groovy/io/codearte/accurest/builder/JUnitMessagingMethodBodyBuilder.groovy +++ b/accurest-core/src/main/groovy/io/codearte/accurest/builder/JUnitMessagingMethodBodyBuilder.groovy @@ -69,6 +69,7 @@ class JUnitMessagingMethodBodyBuilder extends MessagingMethodBodyBuilder { @Override protected void validateResponseHeadersBlock(BlockBuilder bb) { bb.addLine("""AccurestMessage response = accurestMessaging.receiveMessage("${outputMessage.sentTo}");""") + bb.addLine("""assertThat(response).isNotNull();""") outputMessage.headers?.collect { Header header ->\ processHeaderElement(bb, header.name, header.serverValue) } @@ -114,13 +115,13 @@ class JUnitMessagingMethodBodyBuilder extends MessagingMethodBodyBuilder { protected String getInputString() { String request = 'AccurestMessage inputMessage = accurestMessaging.create(' if (inputMessage.messageBody) { - request = "${request}\n\t\t\t\"${StringEscapeUtils.escapeJava(bodyAsString)}\"\n\t\t" + request = "${request}\n \"${StringEscapeUtils.escapeJava(bodyAsString)}\"\n " } if (inputMessage.messageHeaders) { request = "${request}, headers()\n" } inputMessage.messageHeaders?.collect { Header header -> - request = "${request}\t\t\t${getHeaderString(header)}" + request = "${request} ${getHeaderString(header)}" } return "${request})" } diff --git a/accurest-core/src/main/groovy/io/codearte/accurest/builder/SpockMessagingMethodBodyBuilder.groovy b/accurest-core/src/main/groovy/io/codearte/accurest/builder/SpockMessagingMethodBodyBuilder.groovy index 6e89373010..583acc9c73 100644 --- a/accurest-core/src/main/groovy/io/codearte/accurest/builder/SpockMessagingMethodBodyBuilder.groovy +++ b/accurest-core/src/main/groovy/io/codearte/accurest/builder/SpockMessagingMethodBodyBuilder.groovy @@ -63,6 +63,7 @@ class SpockMessagingMethodBodyBuilder extends MessagingMethodBodyBuilder { protected void validateResponseCodeBlock(BlockBuilder bb) { if (outputMessage) { bb.addLine("""def response = accurestMessaging.receiveMessage('${outputMessage.sentTo}')""") + bb.addLine("""assert response != null""") } else { bb.addLine('noExceptionThrown()') } @@ -114,18 +115,18 @@ class SpockMessagingMethodBodyBuilder extends MessagingMethodBodyBuilder { protected String getInputString() { String request = 'def inputMessage = accurestMessaging.create(' if (inputMessage.messageBody) { - request = "${request}'''${bodyAsString}'''\n\t\t" + request = "${request}'''${bodyAsString}'''\n " } if (inputMessage.messageHeaders) { request = "${request},[\n" } def headers = [] inputMessage.messageHeaders?.collect { Header header -> - headers << "\t\t\t${getHeaderString(header)}" + headers << " ${getHeaderString(header)}" } request = "${request}${headers.join(',\n')}" if (inputMessage.messageHeaders) { - request = "${request}\n\t\t]" + request = "${request}\n ]" } return "${request})" } diff --git a/accurest-core/src/test/groovy/io/codearte/accurest/builder/MessagingMethodBodyBuilderSpec.groovy b/accurest-core/src/test/groovy/io/codearte/accurest/builder/MessagingMethodBodyBuilderSpec.groovy index 192c1036e5..1855c7b88b 100644 --- a/accurest-core/src/test/groovy/io/codearte/accurest/builder/MessagingMethodBodyBuilderSpec.groovy +++ b/accurest-core/src/test/groovy/io/codearte/accurest/builder/MessagingMethodBodyBuilderSpec.groovy @@ -30,21 +30,23 @@ def contractDsl = GroovyDsl.make { builder.appendTo(blockBuilder) def test = blockBuilder.toString() then: - stripped(test) == stripped( + String expectedMessage = // tag::trigger_method_test[] ''' -when: - bookReturnedTriggered() + when: + bookReturnedTriggered() + + then: + def response = accurestMessaging.receiveMessage('activemq:output') + assert response != null + response.getHeader('BOOK-NAME') == 'foo' + and: + DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.payload)) + assertThatJson(parsedJson).field("bookName").isEqualTo("foo") -then: - def response = accurestMessaging.receiveMessage('activemq:output') - response.getHeader('BOOK-NAME') == 'foo' -and: - DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.payload)) - assertThatJson(parsedJson).field("bookName").isEqualTo("foo") ''' // end::trigger_method_test[] - ) + stripped(test) == stripped(expectedMessage) } def "should work for triggered based messaging with JUnit"() { @@ -68,25 +70,22 @@ and: builder.appendTo(blockBuilder) def test = blockBuilder.toString() then: - stripped(test) == stripped( + String expectedMessage = // tag::trigger_method_junit_test[] ''' -// when: - bookReturnedTriggered(); + // when: + bookReturnedTriggered(); -// then: - AccurestMessage response = accurestMessaging.receiveMessage("activemq:output"); - assertThat(response.getHeader("BOOK-NAME")).isEqualTo("foo"); -// and: - DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.getPayload())); - assertThatJson(parsedJson).field("bookName").isEqualTo("foo"); + // then: + AccurestMessage response = accurestMessaging.receiveMessage("activemq:output"); + assertThat(response).isNotNull(); + assertThat(response.getHeader("BOOK-NAME")).isEqualTo("foo"); + // and: + DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.getPayload())); + assertThatJson(parsedJson).field("bookName").isEqualTo("foo"); ''' // end::trigger_method_junit_test[] - ) - } - - private String stripped(String text) { - return text.stripIndent().stripMargin().replace(' ', '').replace('\n', '') + stripped(test) == stripped(expectedMessage) } def "should generate tests triggered by a message for Spock"() { @@ -120,27 +119,28 @@ def contractDsl = GroovyDsl.make { builder.appendTo(blockBuilder) def test = blockBuilder.toString() then: - stripped(test) == stripped( + String expectedMessage = // tag::trigger_message_spock[] -''' +"""\ given: - def inputMessage = accurestMessaging.create( - \'\'\'{"bookName":"foo"}\'\'\', - ['sample': 'header'] - ) + def inputMessage = accurestMessaging.create( + '''{"bookName":"foo"}''', + ['sample': 'header'] + ) when: - accurestMessaging.send(inputMessage, 'jms:input') + accurestMessaging.send(inputMessage, 'jms:input') then: - def response = accurestMessaging.receiveMessage('jms:output') - response.getHeader('BOOK-NAME') == 'foo' + def response = accurestMessaging.receiveMessage('jms:output') + assert response !- null + response.getHeader('BOOK-NAME') == 'foo' and: - DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.payload)) - assertThatJson(parsedJson).field("bookName").isEqualTo("foo") -''' + DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.payload)) + assertThatJson(parsedJson).field("bookName").isEqualTo("foo") +""" // end::trigger_message_spock[] - ) + stripped(test) == stripped(expectedMessage) } def "should generate tests triggered by a message for JUnit"() { @@ -172,28 +172,28 @@ and: builder.appendTo(blockBuilder) def test = blockBuilder.toString() then: - stripped(test) == stripped( - // tag::trigger_message_junit[] + String expectedMessage = +// tag::trigger_message_junit[] ''' // given: AccurestMessage inputMessage = accurestMessaging.create( - "{\\"bookName\\":\\"foo\\"}" + "{\\"bookName\\":\\"foo\\"}" , headers() - .header("sample", "header")); + .header("sample", "header")); // when: accurestMessaging.send(inputMessage, "jms:input"); // then: AccurestMessage response = accurestMessaging.receiveMessage("jms:output"); + assertThat(response).isNotNull(); assertThat(response.getHeader("BOOK-NAME")).isEqualTo("foo"); // and: DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.getPayload())); assertThatJson(parsedJson).field("bookName").isEqualTo("foo"); - ''' - // end::trigger_message_junit[] - ) +// end::trigger_message_junit[] + stripped(test) == stripped(expectedMessage) } def "should generate tests without destination, triggered by a message"() { @@ -318,6 +318,7 @@ then: // then: AccurestMessage response = accurestMessaging.receiveMessage("jms:output"); + assertThat(response).isNotNull(); DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.getPayload())); assertThatJson(parsedJson).field("bookName").isEqualTo("foo"); ''' @@ -363,10 +364,15 @@ then: then: def response = accurestMessaging.receiveMessage('jms:output') + assert response != null DocumentContext parsedJson = JsonPath.parse(accurestObjectMapper.writeValueAsString(response.payload)) assertThatJson(parsedJson).field("bookName").isEqualTo("foo") """ stripped(test) == stripped(expectedMsg) } + private String stripped(String text) { + return text.stripIndent().stripMargin().replace(' ', '').replace('\n', '').replace('\t', '').replaceAll("\\W", "") + } + } diff --git a/docs/src/docs/asciidoc/index.adoc b/docs/src/docs/asciidoc/index.adoc index bbc6197a0e..3e3dc3a980 100644 --- a/docs/src/docs/asciidoc/index.adoc +++ b/docs/src/docs/asciidoc/index.adoc @@ -1,4 +1,4 @@ -:messaging_version: 1.0.7 +:messaging_version: 1.1.0 = Accurest diff --git a/docs/src/docs/asciidoc/rest.adoc b/docs/src/docs/asciidoc/rest.adoc index 82bca2efc8..1dc0eda965 100644 --- a/docs/src/docs/asciidoc/rest.adoc +++ b/docs/src/docs/asciidoc/rest.adoc @@ -93,7 +93,7 @@ accurest { - **imports** - array with imports that should be included in generated tests (for example ['org.myorg.Matchers']). By default empty array [] - **staticImports** - array with static imports that should be included in generated tests(for example ['org.myorg.Matchers.*']). By default empty array [] - **basePackageForTests** - specifies base package for all generated tests. By default set to io.codearte.accurest.tests - - **baseClassForTests** - base class for generated tests. By default `spock.lang.Specification` + - **baseClassForTests** - base class for generated tests. By default `spock.lang.Specification` if using Spock tests. - **ruleClassForTests** - specifies Rule which should be added to generated test classes. - **ignoredFiles** - Ant matcher allowing defining stub files for which processing should be skipped. By default empty array [] - **contractsDslDir** - directory containing contracts written using the GroovyDSL. By default `$rootDir/src/test/accurest` @@ -237,7 +237,7 @@ To change default configuration just add `configuration` section to plugin defin - **testMode** - defines mode for acceptance tests. By default `MockMvc` which is based on Spring's MockMvc. It can also be changed to `JaxRsClient` or to `Explicit` for real HTTP calls. - **basePackageForTests** - specifies base package for all generated tests. By default set to `io.codearte.accurest.tests`. - **ruleClassForTests** - specifies Rule which should be added to generated test classes. - - **baseClassForTests** - base class for generated tests. By default `spock.lang.Specification`. + - **baseClassForTests** - base class for generated tests. By default `spock.lang.Specification` if using Spock tests. - **contractsDir** - directory containing contracts written using the GroovyDSL. By default `/src/test/accurest`. - **testFramework** - the target test framework to be used; currently Spock and JUnit are supported with Spock being the default framework diff --git a/samples/messaging-camel/src/test/groovy/io/codearte/accurest/samples/camel/CamelMessagingApplicationSpec.groovy b/samples/messaging-camel/src/test/groovy/io/codearte/accurest/samples/camel/CamelMessagingApplicationSpec.groovy index 0400c9d359..0dfecf7e2e 100644 --- a/samples/messaging-camel/src/test/groovy/io/codearte/accurest/samples/camel/CamelMessagingApplicationSpec.groovy +++ b/samples/messaging-camel/src/test/groovy/io/codearte/accurest/samples/camel/CamelMessagingApplicationSpec.groovy @@ -1,12 +1,12 @@ package io.codearte.accurest.samples.camel -import com.fasterxml.jackson.databind.ObjectMapper import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.JsonPath import com.toomuchcoding.jsonassert.JsonAssertion import io.codearte.accurest.dsl.GroovyDsl import io.codearte.accurest.messaging.AccurestMessage import io.codearte.accurest.messaging.AccurestMessaging +import io.codearte.accurest.messaging.AccurestObjectMapper import org.apache.camel.model.ModelCamelContext import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.SpringApplicationContextLoader @@ -24,7 +24,7 @@ public class CamelMessagingApplicationSpec extends Specification { // ALL CASES @Inject AccurestMessaging accurestMessaging - ObjectMapper accurestObjectMapper = new ObjectMapper() + AccurestObjectMapper accurestObjectMapper = new AccurestObjectMapper() def "should work for triggered based messaging"() { given: diff --git a/samples/messaging-integration/src/test/groovy/io/codearte/accurest/samples/messaging/IntegrationMessagingApplicationSpec.groovy b/samples/messaging-integration/src/test/groovy/io/codearte/accurest/samples/messaging/IntegrationMessagingApplicationSpec.groovy index 98b6f19658..75b453940d 100644 --- a/samples/messaging-integration/src/test/groovy/io/codearte/accurest/samples/messaging/IntegrationMessagingApplicationSpec.groovy +++ b/samples/messaging-integration/src/test/groovy/io/codearte/accurest/samples/messaging/IntegrationMessagingApplicationSpec.groovy @@ -1,26 +1,25 @@ package io.codearte.accurest.samples.messaging -import com.fasterxml.jackson.databind.ObjectMapper import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.JsonPath import com.toomuchcoding.jsonassert.JsonAssertion import io.codearte.accurest.dsl.GroovyDsl import io.codearte.accurest.messaging.AccurestMessage import io.codearte.accurest.messaging.AccurestMessaging +import io.codearte.accurest.messaging.AccurestObjectMapper import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.SpringApplicationContextLoader import org.springframework.test.context.ContextConfiguration import spock.lang.Specification import javax.inject.Inject - // Context configuration would end up in base class @ContextConfiguration(classes = [IntegrationMessagingApplication], loader = SpringApplicationContextLoader) public class IntegrationMessagingApplicationSpec extends Specification { // ALL CASES @Inject AccurestMessaging accurestMessaging - ObjectMapper accurestObjectMapper = new ObjectMapper() + AccurestObjectMapper accurestObjectMapper = new AccurestObjectMapper() def "should work for triggered based messaging"() { given: diff --git a/samples/messaging-spring/src/test/groovy/io/codearte/accurest/samples/spring/SpringApplicationSpec.groovy b/samples/messaging-spring/src/test/groovy/io/codearte/accurest/samples/spring/SpringApplicationSpec.groovy index a6296a02ae..0c79f467c2 100644 --- a/samples/messaging-spring/src/test/groovy/io/codearte/accurest/samples/spring/SpringApplicationSpec.groovy +++ b/samples/messaging-spring/src/test/groovy/io/codearte/accurest/samples/spring/SpringApplicationSpec.groovy @@ -1,12 +1,12 @@ package io.codearte.accurest.samples.spring -import com.fasterxml.jackson.databind.ObjectMapper import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.JsonPath import com.toomuchcoding.jsonassert.JsonAssertion import io.codearte.accurest.dsl.GroovyDsl import io.codearte.accurest.messaging.AccurestMessage import io.codearte.accurest.messaging.AccurestMessaging +import io.codearte.accurest.messaging.AccurestObjectMapper import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.SpringApplicationContextLoader import org.springframework.test.context.ContextConfiguration @@ -14,7 +14,6 @@ import spock.lang.Specification import spock.util.concurrent.PollingConditions import javax.inject.Inject - /** * SPIKE ON TESTS FROM NOTES IN MessagingSpec */ @@ -24,7 +23,7 @@ public class SpringApplicationSpec extends Specification { // ALL CASES @Inject AccurestMessaging accurestMessaging - ObjectMapper accurestObjectMapper = new ObjectMapper() + AccurestObjectMapper accurestObjectMapper = new AccurestObjectMapper() def "should work for triggered based messaging"() { given: diff --git a/samples/messaging-stream/src/test/groovy/io/codearte/accurest/samples/messaging/StreamMessagingApplicationSpec.groovy b/samples/messaging-stream/src/test/groovy/io/codearte/accurest/samples/messaging/StreamMessagingApplicationSpec.groovy index 4cc5d1b2e0..597f693709 100644 --- a/samples/messaging-stream/src/test/groovy/io/codearte/accurest/samples/messaging/StreamMessagingApplicationSpec.groovy +++ b/samples/messaging-stream/src/test/groovy/io/codearte/accurest/samples/messaging/StreamMessagingApplicationSpec.groovy @@ -1,19 +1,18 @@ package io.codearte.accurest.samples.messaging -import com.fasterxml.jackson.databind.ObjectMapper import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.JsonPath import com.toomuchcoding.jsonassert.JsonAssertion import io.codearte.accurest.dsl.GroovyDsl import io.codearte.accurest.messaging.AccurestMessage import io.codearte.accurest.messaging.AccurestMessaging +import io.codearte.accurest.messaging.AccurestObjectMapper import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.SpringApplicationContextLoader import org.springframework.test.context.ContextConfiguration import spock.lang.Specification import javax.inject.Inject - /** * SPIKE ON TESTS FROM NOTES IN MessagingSpec */ @@ -23,7 +22,7 @@ public class StreamMessagingApplicationSpec extends Specification { // ALL CASES @Inject AccurestMessaging accurestMessaging - ObjectMapper accurestObjectMapper = new ObjectMapper() + AccurestObjectMapper accurestObjectMapper = new AccurestObjectMapper() def "should work for triggered based messaging"() { given: diff --git a/stub-runner/stub-runner-messaging/stub-runner-messaging-camel/src/main/groovy/io/codearte/accurest/stubrunner/messaging/camel/StubRunnerCamelPredicate.groovy b/stub-runner/stub-runner-messaging/stub-runner-messaging-camel/src/main/groovy/io/codearte/accurest/stubrunner/messaging/camel/StubRunnerCamelPredicate.groovy index 3ab58d6d8e..b38b82fabe 100644 --- a/stub-runner/stub-runner-messaging/stub-runner-messaging-camel/src/main/groovy/io/codearte/accurest/stubrunner/messaging/camel/StubRunnerCamelPredicate.groovy +++ b/stub-runner/stub-runner-messaging/stub-runner-messaging-camel/src/main/groovy/io/codearte/accurest/stubrunner/messaging/camel/StubRunnerCamelPredicate.groovy @@ -1,12 +1,12 @@ package io.codearte.accurest.stubrunner.messaging.camel -import com.fasterxml.jackson.databind.ObjectMapper import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.JsonPath import com.toomuchcoding.jsonassert.JsonAssertion import com.toomuchcoding.jsonassert.JsonVerifiable import groovy.transform.PackageScope import io.codearte.accurest.dsl.GroovyDsl +import io.codearte.accurest.messaging.AccurestObjectMapper import io.codearte.accurest.util.JsonPaths import io.codearte.accurest.util.JsonToJsonPathsConverter import org.apache.camel.Exchange @@ -23,7 +23,7 @@ import java.util.regex.Pattern class StubRunnerCamelPredicate implements Predicate { private final GroovyDsl groovyDsl - private final ObjectMapper objectMapper = new ObjectMapper() + private final AccurestObjectMapper objectMapper = new AccurestObjectMapper() StubRunnerCamelPredicate(GroovyDsl groovyDsl) { this.groovyDsl = groovyDsl diff --git a/stub-runner/stub-runner-messaging/stub-runner-messaging-integration/src/main/groovy/io/codearte/accurest/stubrunner/messaging/integration/StubRunnerIntegrationMessageSelector.groovy b/stub-runner/stub-runner-messaging/stub-runner-messaging-integration/src/main/groovy/io/codearte/accurest/stubrunner/messaging/integration/StubRunnerIntegrationMessageSelector.groovy index 1184f0acef..1bdf1398f2 100644 --- a/stub-runner/stub-runner-messaging/stub-runner-messaging-integration/src/main/groovy/io/codearte/accurest/stubrunner/messaging/integration/StubRunnerIntegrationMessageSelector.groovy +++ b/stub-runner/stub-runner-messaging/stub-runner-messaging-integration/src/main/groovy/io/codearte/accurest/stubrunner/messaging/integration/StubRunnerIntegrationMessageSelector.groovy @@ -1,19 +1,18 @@ package io.codearte.accurest.stubrunner.messaging.integration -import com.fasterxml.jackson.databind.ObjectMapper import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.JsonPath import com.toomuchcoding.jsonassert.JsonAssertion import com.toomuchcoding.jsonassert.JsonVerifiable import groovy.transform.CompileStatic import io.codearte.accurest.dsl.GroovyDsl +import io.codearte.accurest.messaging.AccurestObjectMapper import io.codearte.accurest.util.JsonPaths import io.codearte.accurest.util.JsonToJsonPathsConverter import org.springframework.integration.core.MessageSelector import org.springframework.messaging.Message import java.util.regex.Pattern - /** * Passes through a message that matches the one defined in the DSL * @@ -23,7 +22,7 @@ import java.util.regex.Pattern class StubRunnerIntegrationMessageSelector implements MessageSelector { private final GroovyDsl groovyDsl - private final ObjectMapper objectMapper = new ObjectMapper() + private final AccurestObjectMapper objectMapper = new AccurestObjectMapper() StubRunnerIntegrationMessageSelector(GroovyDsl groovyDsl) { this.groovyDsl = groovyDsl diff --git a/stub-runner/stub-runner-messaging/stub-runner-messaging-stream/src/main/groovy/io/codearte/accurest/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.groovy b/stub-runner/stub-runner-messaging/stub-runner-messaging-stream/src/main/groovy/io/codearte/accurest/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.groovy index 37e60c85b7..628f423cf4 100644 --- a/stub-runner/stub-runner-messaging/stub-runner-messaging-stream/src/main/groovy/io/codearte/accurest/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.groovy +++ b/stub-runner/stub-runner-messaging/stub-runner-messaging-stream/src/main/groovy/io/codearte/accurest/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.groovy @@ -1,19 +1,18 @@ package io.codearte.accurest.stubrunner.messaging.stream -import com.fasterxml.jackson.databind.ObjectMapper import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.JsonPath import com.toomuchcoding.jsonassert.JsonAssertion import com.toomuchcoding.jsonassert.JsonVerifiable import groovy.transform.CompileStatic import io.codearte.accurest.dsl.GroovyDsl +import io.codearte.accurest.messaging.AccurestObjectMapper import io.codearte.accurest.util.JsonPaths import io.codearte.accurest.util.JsonToJsonPathsConverter import org.springframework.integration.core.MessageSelector import org.springframework.messaging.Message import java.util.regex.Pattern - /** * Passes through a message that matches the one defined in the DSL * @@ -23,7 +22,7 @@ import java.util.regex.Pattern class StubRunnerStreamMessageSelector implements MessageSelector { private final GroovyDsl groovyDsl - private final ObjectMapper objectMapper = new ObjectMapper() + private final AccurestObjectMapper objectMapper = new AccurestObjectMapper() StubRunnerStreamMessageSelector(GroovyDsl groovyDsl) { this.groovyDsl = groovyDsl