changed to reflect the function's acceptance of either simple string … (#3294)
* changed to reflect the function's acceptance of either simple string or regex * cast p into a Pattern * cast p into a Pattern * Changed test to reflect the new output from function.
This commit is contained in:
parent
77f26c1218
commit
352127558a
@ -55,9 +55,7 @@ public class Find implements Function {
|
||||
}
|
||||
|
||||
if (s != null && p != null && p instanceof Pattern) {
|
||||
|
||||
Pattern pattern = (p instanceof String) ? Pattern.compile((String) p) : (Pattern) p;
|
||||
|
||||
Pattern pattern = (Pattern) p;
|
||||
Matcher matcher = pattern.matcher(s.toString());
|
||||
|
||||
while (matcher.find()) {
|
||||
@ -72,7 +70,7 @@ public class Find implements Function {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Returns all the occurances of match given regular expression";
|
||||
return "Returns all the occurrences of match given regular expression or simple string";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +75,7 @@ public class FindTests extends RefineTest {
|
||||
|
||||
@Test
|
||||
public void serializeFind() {
|
||||
String json = "{\"description\":\"Returns all the occurances of match given regular expression\",\"params\":\"string or regexp\",\"returns\":\"array of strings\"}";
|
||||
String json = "{\"description\":\"Returns all the occurrences of match given regular expression or simple string\",\"params\":\"string or regexp\",\"returns\":\"array of strings\"}";
|
||||
TestUtils.isSerializedTo(new Find(), json);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user