|
31 | 31 | import com.intuit.karate.StringUtils;
|
32 | 32 | import java.lang.reflect.InvocationTargetException;
|
33 | 33 | import java.lang.reflect.Method;
|
34 |
| -import java.util.ArrayList; |
35 |
| -import java.util.Arrays; |
36 |
| -import java.util.Collection; |
37 |
| -import java.util.HashMap; |
38 |
| -import java.util.HashSet; |
39 |
| -import java.util.List; |
40 |
| -import java.util.Map; |
41 |
| -import java.util.Objects; |
42 |
| -import java.util.StringJoiner; |
| 34 | +import java.util.*; |
43 | 35 | import java.util.regex.Matcher;
|
44 | 36 | import java.util.regex.Pattern;
|
45 | 37 | import org.slf4j.LoggerFactory;
|
@@ -261,8 +253,18 @@ public static Result execute(Step step, Actions actions) {
|
261 | 253 | KarateException e = new KarateException("no step-definition method match found for: " + text);
|
262 | 254 | return Result.failed(System.currentTimeMillis(), 0, e, step);
|
263 | 255 | } else if (matches.size() > 1) {
|
264 |
| - KarateException e = new KarateException("more than one step-definition method matched: " + text + " - " + matches); |
265 |
| - return Result.failed(System.currentTimeMillis(), 0, e, step); |
| 256 | + boolean evalAssign = false; // special case to support foo.bar = (docstring) in cucumber syntax |
| 257 | + for (MethodMatch m : matches) { |
| 258 | + if (m.getMethod().getName().equalsIgnoreCase("evalAssignDocString")) { |
| 259 | + evalAssign = true; |
| 260 | + matches = Collections.singletonList(m); |
| 261 | + break; |
| 262 | + } |
| 263 | + } |
| 264 | + if (!evalAssign) { |
| 265 | + KarateException e = new KarateException("more than one step-definition method matched: " + text + " - " + matches); |
| 266 | + return Result.failed(System.currentTimeMillis(), 0, e, step); |
| 267 | + } |
266 | 268 | }
|
267 | 269 | MethodMatch match = matches.get(0);
|
268 | 270 | Object last;
|
|
0 commit comments