Uh oh!
There was an error while loading. Please reload this page.
Simplified the StartsActivity by reducing the number of parameters through POJO class - #579
Conversation
Simplified the StartsActivity by reducing the number of parameters through the POJO class.
email2vimalraj
commented
Feb 22, 2017
Could someone please explain why the CI build has failed? |
email2vimalraj
commented
Feb 22, 2017
@SrinivasanTarget : Kindly help me what I'm supposed to fix in the build error. |
saikrishna321
commented
Feb 22, 2017
@email2vimalraj you have styling issues. Please fix them https://travis-ci.org/appium/java-client/builds/204062313#L1987 you can ignore the warnings |
SrinivasanTarget
commented
Feb 22, 2017
@email2vimalraj Hey buddy sorry just checked your note. please fix the errors to review. |
| * } | ||
| * </pre> | ||
| * | ||
| * @param appPackage The package containing the activity. [Required] |
There was a problem hiding this comment.
@email2vimalraj I'm against this change as it is. Please mark these methods Deprecated and with the description to use new ones
| /** | ||
| * This is a simple POJO class to support the {@link StartsActivity}. | ||
| */ | ||
| public class Activity { |
There was a problem hiding this comment.
I this this POJO should have 2 mandatory parameteres: package and activity. Please add the constructor with these parameters.
| * | ||
| * @param appPackage The app package value. | ||
| */ | ||
| public void setAppPackage(String appPackage) { |
There was a problem hiding this comment.
I like the idea behind this but have few things to be discussed here,
Is there a way to remove getters & setters? May be we need to come up with either custom annotation or something like https://github.com/rzwitserloot/lombok. May be not necessarily in this PR but subjective to discussion if there is any scope of improvement.
There was a problem hiding this comment.
Read the user review who was using the lombok for more than a year: http://stackoverflow.com/a/12807937/1505987
I would recommend to stay away from lombok, even though I never used it personally. My justification would be obviously a javadoc and everytime we will have to generate the code.
There was a problem hiding this comment.
I also don't recommend lombock. But i liked their way of using annotations.
email2vimalraj
commented
Feb 22, 2017
The CI is still pending from long time. Could someone look into it? |
Have restarted travisCI job lets see. Anyways we need to wait for Codacy to complete. |
Seems some issue with Travis, it keeps the job in queue, but not running it up. |
SrinivasanTarget
commented
Feb 22, 2017
Yes checking |
email2vimalraj
commented
Feb 23, 2017
Any updates on CI? |
email2vimalraj
commented
Feb 23, 2017
@SrinivasanTarget@TikhomirovSergey : Can any one of you please help on the Travis issue? Seems the travis doesn't like to run my PR :( |
SrinivasanTarget
commented
Feb 23, 2017
@email2vimalraj I'll check with @imurchie and see if we could do something. |
Seems Travis finally ran my PR and this time build passed. :) https://travis-ci.org/appium/java-client/builds/204446236#L1990 |
| StartsActivity startsActivity.startActivity("your.package.name", ".ActivityName"); | ||
| Activity activity = new Activity(); | ||
| activity.setAppPackage("your.package.name"); |
There was a problem hiding this comment.
@email2vimalraj Can you update here too.
email2vimalraj
commented
Feb 24, 2017
@SrinivasanTarget : Fixed, kindly have a look |
| * @param appPackage The value for the app package. | ||
| * @param appActivity The value for the app activity. | ||
| */ | ||
| public Activity(String appPackage, String appActivity) { |
There was a problem hiding this comment.
@email2vimalraj Could you provide these checkings:
importstaticcom.google.common.base.Preconditions.checkArgument;
importstaticorg.apache.commons.lang3.StringUtils.isBlank;
...
publicActivity(StringappPackage, StringappActivity) {
checkArgument(!isBlank(appPackage), "App package should be defined as not empty or null string");
checkArgument(!isBlank(appActivity), "App activity should be defined as not empty or null string");
...
}| * | ||
| * @param appActivity The app activity value. | ||
| */ | ||
| public void setAppActivity(String appActivity) { |
There was a problem hiding this comment.
I'm not sure that it is necessary to keep this method. Maybe it is more senseful to keep only getter for activity and make this field final. @SrinivasanTarget What is your opinion?
| * | ||
| * @param appPackage The app package value. | ||
| */ | ||
| public void setAppPackage(String appPackage) { |
There was a problem hiding this comment.
I'm not sure that it is necessary to keep this method. Maybe it is more senseful to keep only getter for package and make this field final. @SrinivasanTarget What is your opinion?
There was a problem hiding this comment.
+1 - Making this final would be a better option 👍
TikhomirovSergey
commented
Feb 25, 2017
@email2vimalraj I have finished the reviewing. It is almost ok. @email2vimalraj Could you read comments and make some improvenents? ping @SrinivasanTarget |
…Also made the mandatory parameters final and removed setters.
email2vimalraj
commented
Feb 25, 2017
@TikhomirovSergey and @SrinivasanTarget : Done the changes as recommended |
TikhomirovSergey
commented
Feb 25, 2017
@email2vimalraj I have approved these changes. @SrinivasanTarget ? |
SrinivasanTarget
commented
Feb 25, 2017
@email2vimalraj It's a merge away. Waiting for Codacy to be happy. |
SrinivasanTarget
commented
Feb 25, 2017
Thanks @email2vimalraj 👍 |
Simplified the StartsActivity by reducing the number of parameters through POJO class
Change list
Currently the number of
startActivitymethods are unnecessary which can be solved by one single method with single parameter. So introduced the simple POJO class which in future can be expanded with any number of parameters.Types of changes
What types of changes are you proposing/introducing to Java client?
Details
The sample usage of new implementation is as follows: