cygne
cygne

Reputation: 547

How to send an array from karate feature to Java method?

We have a java method which accept one String and an array of String:

public static void foo(String bar, String... parts){
    modify parameters...
}

We would like to send parameters from karate feature:

* def temp = JavaClass.foo(bar, part1, part2)

It works, but only bar and part2 are sent to foo method. How we can send an array of Strings from karate feature, smth like

* def temp = JavaClass.foo(bar, [part1, part2])

Sorry if we didn't see the issue in official github repo. Thanks

Upvotes: 1

Views: 954

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Try making the parts argument as a Java list, it should work then.

public static void foo(String bar, List<String> parts){

Upvotes: 1

Related Questions