Skip to content

Commit

Permalink
revert to a working state
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkranga committed Apr 22, 2024
1 parent 14309df commit 65161c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/test/java/io/pactflow/example/kafka/ProductsPactTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ MessagePact createPact(MessagePactBuilder builder) {
PactDslJsonBody body = new PactDslJsonBody();
body.stringType("name", "product name");
body.stringType("type", "product series");
body.stringType("id", "v2"); // testing
body.stringType("id", "5cc989d0-d800-434c-b4bb-b1268499e850");
// body.stringType("id", "v2"); // testing failing scenario
body.stringMatcher("version", "v[a-zA-z0-9]+", "v1");
body.stringMatcher("id", "v[a-zA-z0-9]+", "v1"); // testing
// body.stringMatcher("id", "v[a-zA-z0-9]+", "v1"); // testing failing scenario
body.stringMatcher("event", "^(CREATED|UPDATED|DELETED)$", "CREATED");

Map<String, Object> metadata = new HashMap<>();
Expand All @@ -51,8 +52,10 @@ MessagePact createPact(MessagePactBuilder builder) {
void test(List<Message> messages) throws Exception {
ObjectMapper mapper = new ObjectMapper();
System.out.println("Message received -> " + messages.get(0).contentsAsString());
System.out.println(messages.get(0).getMetadata().get("kafka_topic"));
Product product = mapper.readValue(messages.get(0).contentsAsString(), Product.class);


assertDoesNotThrow(() -> {
listener.listen(product);
});
Expand Down

0 comments on commit 65161c3

Please sign in to comment.