AmqpTarget missing on pact-jvm-provider-junit 3.5.0-beta.2
See original GitHub issueI’m trying to get a simple test for consumer & producer up and running in a Messaging Queue scenario with pact-jvm-provider-junit and pact-jvm-consumer-junit. I tried running 3.3.4 where AmqpTarget exists, but the consumer part seems to generate a message format which doesn’t play nicely with JSON data comparisons. This code:
PactDslJsonBody body = new PactDslJsonBody()
.stringValue("name", "value1")
.numberValue("value", 1);
Map<String, String> metadata = new HashMap<String, String>();
metadata.put("contentType", "application/json");
return builder.given("SomeProviderState")
.expectsToReceive("a test message")
.withMetadata(metadata)
.withContent(body)
.toPact();
Produces a pact-file like:
{
"description": "a test message",
"metaData": {
"contentType": "application/json",
"Content-Type": "application/json; charset=UTF-8"
},
"contents": "{name=value1, value=1}",
"providerState": "SomeProviderState"
}
The contents then fail my provider tests, as it’s doing the comparison wrong. This very simple test:
@PactVerifyProvider("a test message")
public String verifySimpleMessage() throws Exception {
ExampleThing thing = new ExampleThing();
thing.name = "value1";
thing.value = 1;
return DummyEventHandler.exampleThingToJson(thing);
}
fails with
java.lang.AssertionError:
0 - $.body -> Expected '{name=value1, value=1}' but received Map(name -> value1, value -> 1)
Upgrading to 3.5.0-beta.2 I get much better pact-file output from my consumer, but the AmqpTarget class doesn’t exist so I can’t test my producer. The 3.5.0-beta.2 pact-file for the same code as above is:
{
"description": "a test message",
"contents": {
"name": "value1",
"value": 1
},
"providerState": "SomeProviderState"
}
Should AmqpTarget exist in the 3.5-branches, or is there another way of doing these tests in 3.5 that I’m missing?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Yes it was a regression, possibly introduced in version 3.3.0, but the AmqpTarget was introduced in 3.3.2.
I should be able to get a new 3.3.x version out soon, the 3.5.x will take a little longer.
Closing this as v3.5.x has been released.