Skip to content

Commit a46937a

Browse files
author
Ronald Holshausen
committed
fixes to the consumer DSL for multiple interactions
1 parent a3c5468 commit a46937a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

pact-jvm-consumer-junit/src/main/java/au/com/dius/pact/consumer/ConsumerPactBuilder.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,20 @@ public PactDslRequestWithPath(String consumerName,
109109
this.requestBody = requestBody;
110110
}
111111

112-
public PactDslRequestWithPath(List<Interaction> interactions, String state, String description) {
113-
this.interactions = interactions;
114-
this.state = state;
112+
public PactDslRequestWithPath(PactDslRequestWithPath existing, String description) {
113+
this.consumer = existing.consumer;
114+
this.provider = existing.provider;
115+
116+
this.state = existing.state;
117+
115118
this.description = description;
119+
this.path = existing.path;
120+
this.requestMethod = existing.requestMethod;
121+
this.requestHeaders = existing.requestHeaders;
122+
this.requestBody = existing.requestBody;
123+
124+
125+
this.interactions = existing.interactions;
116126
}
117127

118128
public PactDslRequestWithPath method(String method) {
@@ -179,10 +189,9 @@ public PactFragment toFragment() {
179189
JavaConverters$.MODULE$.asScalaBufferConverter(existing.interactions).asScala());
180190
}
181191

182-
//TODO: this mechanism allows creating subsequent requests without a path... fix that
183192
public PactDslRequestWithPath uponRecieving(String description) {
184193
addInteraction();
185-
return new PactDslRequestWithPath(existing.interactions, existing.state, description);
194+
return new PactDslRequestWithPath(existing, description);
186195
}
187196
}
188197
}

0 commit comments

Comments
 (0)