Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Feature/data utils keywords #82

Merged
merged 3 commits into from
Jul 29, 2019

Conversation

YauheniPo
Copy link
Contributor

No description provided.

} else {
Collections.sort(listOfStrings);
}
logging.info(String.format("Sorted list '%s' by %s", sortedList, order.toUpperCase()));

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.

Copy link
Contributor Author

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();

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)

Copy link
Contributor Author

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();

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.

Copy link
Contributor Author

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, "");

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, fixed

// Keywords
// ##############################

@RobotKeyword

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 ;-)

Copy link
Contributor Author

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) {

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.

Copy link
Contributor Author

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) {

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.

Copy link
Contributor Author

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) {

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?

Copy link
Contributor Author

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. removed

@Hi-Fi Hi-Fi merged commit 3e8bc73 into MarketSquare:develop Jul 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants