-
Notifications
You must be signed in to change notification settings - Fork 16
Feature/data utils keywords #82
Feature/data utils keywords #82
Conversation
Update fork branch
} else { | ||
Collections.sort(listOfStrings); | ||
} | ||
logging.info(String.format("Sorted list '%s' by %s", sortedList, order.toUpperCase())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
order.toUpperCase()
-> order.toUpperCase(Locale.ENGLISH)
or something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE
@RobotKeyword | ||
@ArgumentNames({"text", "regExpPattern"}) | ||
public boolean isTextMatchPattern(String text, String regExpPattern) { | ||
return Pattern.compile(regExpPattern).matcher(text).matches(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check arguments for null?
Also, this code looks like doing the same as text.matches(regExpPattern)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@ArgumentNames({"text", "regExpPattern", "groupIndex"}) | ||
public String getStringByRegexpGroup(String text, String regExpPattern, int groupIndex) { | ||
Matcher matcher = Pattern.compile(regExpPattern).matcher(text); | ||
matcher.find(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we don't check the return value of find()
here? It seems like we should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
String message = robot.getParamsValue(params, 0, ""); | ||
int index = robot.getParamsValue(params, 1, 0); | ||
int index = robot.getParamsValue(params, 0, 0); | ||
String message = robot.getParamsValue(params, 1, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you fix a bug here? Or... what has been changed here then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fixed
// Keywords | ||
// ############################## | ||
|
||
@RobotKeyword |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add a new keywords, should we add documentation to them as well? Ideally, to also have tests ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
@RobotKeyword | ||
@ArgumentNames({"list", "order=ascending"}) | ||
public List<String> sortStringList(String listToString, String... params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a methods for sorting strings belongs to DateUtils? It seems like it should be placed to some other place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataUtils class
|
||
@RobotKeyword | ||
@ArgumentNames({"text", "regExpPattern", "groupIndex"}) | ||
public String getStringByRegexpGroup(String text, String regExpPattern, int groupIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, we should rename a class because all these methods have nothing with dates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
|
||
@RobotKeyword | ||
@ArgumentNames({"list", "order=ascending"}) | ||
public List<String> sortStringList(String listToString, String... params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... we have https://robotframework.org/robotframework/latest/libraries/Collections.html#Sort%20List so, why would we need this one? Only to sort in descending order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this keyword because I had UI table column data sorting validation (ascending and
descending)
|
||
@RobotKeyword | ||
@ArgumentNames({"text", "regExpPattern"}) | ||
public boolean isTextMatchPattern(String text, String regExpPattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the same as https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Should%20Match%20Regexp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. removed
|
||
@RobotKeyword | ||
@ArgumentNames({"text", "regExpPattern", "groupIndex"}) | ||
public String getStringByRegexpGroup(String text, String regExpPattern, int groupIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we can't use https://robotframework.org/robotframework/latest/libraries/String.html#Get%20Regexp%20Matches instead of this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. removed
No description provided.