khaldrogo 91
khaldrogo 91

Reputation: 55

Karate - declare and pass array of string as an argument to java function while matching in karate feature file

I have an array of string, name = ["abc","xyz"], which i need to declare and pass to java function which accepts array of string as first argument and string as a second argument

public void checkmatch(Strings names[], String city)

the feature is like below

Scenario : ....

def match = JavaType('MatchChecker')
def names = ["abc","xyz"]
when ..
then..
And match.checkmatch(names, "HYD")

Currently this is giving compile time error due to incorrect syntax.

How do I declare and pass these two parameter to checkmatch method.

Upvotes: 1

Views: 40

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Try using List<String> instead of String[] as the first argument type.

Upvotes: 0

Related Questions