Skip to content

Commit 2b466d5

Browse files
authored
Fx/call method split (#126)
* fix: method split with optional space
1 parent be92f2e commit 2b466d5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tzatziki-core/src/main/java/com/decathlon/tzatziki/steps/ObjectSteps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ private <E> E getProperty(Object host, String property, boolean instanciateIfNot
636636
} else if (property.matches("\\w+\\(((?:[^)],?)*+)\\)")) {
637637
String[] splitMethodNameAndArgs = property.split("[()]");
638638
String methodName = splitMethodNameAndArgs[0];
639-
String[] parameters = splitMethodNameAndArgs.length == 1 ? new String[0] : splitMethodNameAndArgs[1].split(", ");
639+
String[] parameters = splitMethodNameAndArgs.length == 1 ? new String[0] : splitMethodNameAndArgs[1].split("[, ]+");
640640
String parametersAsJson = Mapper.toJson(IntStream.range(0, parameters.length).boxed().collect(Collectors.toMap(Function.identity(), idx -> parameters[idx])));
641641

642642
return host instanceof Class<?> hostClass

tzatziki-core/src/test/resources/com/decathlon/tzatziki/steps/objects.feature

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,10 @@ Feature: to interact with objects in the context
701701
helloWorld
702702
.replaceAll(e, 3)
703703
.replaceAll(l, 1)
704-
.replaceAll(o, 0)
704+
.replaceAll(
705+
o,
706+
0
707+
)
705708
706709
]}}'}}
707710
"""

0 commit comments

Comments
 (0)