Skip to content

Commit

Permalink
Merge pull request #2525 from f-delahaye/2168-more-friendly-api
Browse files Browse the repository at this point in the history
added fluent api
  • Loading branch information
ptrthomas authored Mar 8, 2024
2 parents c0597e5 + 54931ee commit 17300d0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ public class KarateProtocolBuilder implements ProtocolBuilder {

private final Map<String, Seq<MethodPause>> uriPatterns;

// Takes a JAVA Map (easier for testing) containaing SCALA MethodPauses (easier to read, save an extra Java MethodPause class and another conversion)
// Takes a JAVA Map (easier for testing) containaing SCALA MethodPauses (easier to read, saves an extra Java MethodPause class and another conversion)
public KarateProtocolBuilder(java.util.Map<String, Seq<MethodPause>> uriPatterns) {
this.uriPatterns = Converters.toScalaMap(uriPatterns);
}

public KarateProtocolBuilder nameResolver(BiFunction<HttpRequest, ScenarioRuntime, String> nameResolver) {
this.nameResolver = nameResolver;
return this;
}

@Override
public KarateProtocol protocol() {
KarateProtocol protocol = new KarateProtocol(uriPatterns);
Expand Down

0 comments on commit 17300d0

Please sign in to comment.