@@ -34,9 +34,10 @@ MessagePact createPact(MessagePactBuilder builder) {
34
34
PactDslJsonBody body = new PactDslJsonBody ();
35
35
body .stringType ("name" , "product name" );
36
36
body .stringType ("type" , "product series" );
37
- body .stringType ("id" , "v2" ); // testing
37
+ body .stringType ("id" , "5cc989d0-d800-434c-b4bb-b1268499e850" );
38
+ // body.stringType("id", "v2"); // testing failing scenario
38
39
body .stringMatcher ("version" , "v[a-zA-z0-9]+" , "v1" );
39
- body .stringMatcher ("id" , "v[a-zA-z0-9]+" , "v1" ); // testing
40
+ // body.stringMatcher("id", "v[a-zA-z0-9]+", "v1"); // testing failing scenario
40
41
body .stringMatcher ("event" , "^(CREATED|UPDATED|DELETED)$" , "CREATED" );
41
42
42
43
Map <String , Object > metadata = new HashMap <>();
@@ -51,8 +52,10 @@ MessagePact createPact(MessagePactBuilder builder) {
51
52
void test (List <Message > messages ) throws Exception {
52
53
ObjectMapper mapper = new ObjectMapper ();
53
54
System .out .println ("Message received -> " + messages .get (0 ).contentsAsString ());
55
+ System .out .println (messages .get (0 ).getMetadata ().get ("kafka_topic" ));
54
56
Product product = mapper .readValue (messages .get (0 ).contentsAsString (), Product .class );
55
57
58
+
56
59
assertDoesNotThrow (() -> {
57
60
listener .listen (product );
58
61
});
0 commit comments