Skip to content

Commit b9e182d

Browse files
Github workflow fixes
1 parent e6e0bb6 commit b9e182d

File tree

8 files changed

+111
-77
lines changed

8 files changed

+111
-77
lines changed

src/main/java/io/appium/java_client/AppiumBy.java

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
package io.appium.java_client;
1818

19-
import lombok.AccessLevel;
2019
import lombok.Getter;
21-
import lombok.NoArgsConstructor;
2220
import org.apache.commons.lang3.Validate;
2321
import org.openqa.selenium.By;
2422
import org.openqa.selenium.By.Remotable;
@@ -31,7 +29,8 @@
3129

3230
public abstract class AppiumBy extends By implements Remotable {
3331

34-
@Getter private final Parameters remoteParameters;
32+
@Getter
33+
private final Parameters remoteParameters;
3534
private final String locatorName;
3635

3736
protected AppiumBy(String selector, String locatorString, String locatorName) {
@@ -40,15 +39,18 @@ protected AppiumBy(String selector, String locatorString, String locatorName) {
4039
this.locatorName = locatorName;
4140
}
4241

43-
@Override public List<WebElement> findElements(SearchContext context) {
42+
@Override
43+
public List<WebElement> findElements(SearchContext context) {
4444
return context.findElements(this);
4545
}
4646

47-
@Override public WebElement findElement(SearchContext context) {
47+
@Override
48+
public WebElement findElement(SearchContext context) {
4849
return context.findElement(this);
4950
}
5051

51-
@Override public String toString() {
52+
@Override
53+
public String toString() {
5254
return String.format("%s.%s: %s", AppiumBy.class.getSimpleName(), locatorName, remoteParameters.value());
5355
}
5456

@@ -58,6 +60,7 @@ protected AppiumBy(String selector, String locatorString, String locatorName) {
5860
* About iOS accessibility
5961
* <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/">https://developer.apple.com/library/ios/documentation/UIKit/Reference/</a>
6062
* UIAccessibilityIdentification_Protocol/index.html
63+
*
6164
* @param accessibilityId id is a convenient UI automation accessibility Id.
6265
* @return an instance of {@link AppiumBy.ByAndroidUIAutomator}
6366
*/
@@ -67,9 +70,10 @@ public static By accessibilityId(final String accessibilityId) {
6770

6871
/**
6972
* This locator strategy is only available in Espresso Driver mode.
73+
*
7074
* @param dataMatcherString is a valid json string detailing hamcrest matcher for Espresso onData().
71-
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
72-
* the documentation</a> for more details
75+
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
76+
* the documentation</a> for more details.
7377
* @return an instance of {@link AppiumBy.ByAndroidDataMatcher}
7478
*/
7579
public static By androidDataMatcher(final String dataMatcherString) {
@@ -78,6 +82,7 @@ public static By androidDataMatcher(final String dataMatcherString) {
7882

7983
/**
8084
* Refer to <a href="https://developer.android.com/training/testing/ui-automator">https://developer.android.com/training/testing/ui-automator</a>
85+
*
8186
* @param uiautomatorText is Android UIAutomator string
8287
* @return an instance of {@link AppiumBy.ByAndroidUIAutomator}
8388
*/
@@ -87,9 +92,10 @@ public static By androidUIAutomator(final String uiautomatorText) {
8792

8893
/**
8994
* This locator strategy is only available in Espresso Driver mode.
95+
*
9096
* @param viewMatcherString is a valid json string detailing hamcrest matcher for Espresso onView().
91-
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
92-
* the documentation</a> for more details
97+
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
98+
* the documentation</a> for more details
9399
* @return an instance of {@link AppiumBy.ByAndroidViewMatcher}
94100
*/
95101
public static By androidViewMatcher(final String viewMatcherString) {
@@ -98,9 +104,10 @@ public static By androidViewMatcher(final String viewMatcherString) {
98104

99105
/**
100106
* This locator strategy is available in Espresso Driver mode.
101-
* @since Appium 1.8.2 beta
107+
*
102108
* @param tag is a view tag string
103109
* @return an instance of {@link ByAndroidViewTag}
110+
* @since Appium 1.8.2 beta
104111
*/
105112
public static By androidViewTag(final String tag) {
106113
return new ByAndroidViewTag(tag);
@@ -109,6 +116,7 @@ public static By androidViewTag(final String tag) {
109116
/**
110117
* For IOS it is the full name of the XCUI element and begins with XCUIElementType.
111118
* For Android it is the full name of the UIAutomator2 class (e.g.: android.widget.TextView)
119+
*
112120
* @param selector the class name of the element
113121
* @return an instance of {@link ByClassName}
114122
*/
@@ -119,6 +127,7 @@ public static By className(final String selector) {
119127
/**
120128
* For IOS the element name.
121129
* For Android it is the resource identifier.
130+
*
122131
* @param selector element id
123132
* @return an instance of {@link ById}
124133
*/
@@ -129,6 +138,7 @@ public static By id(final String selector) {
129138
/**
130139
* For IOS the element name.
131140
* For Android it is the resource identifier.
141+
*
132142
* @param selector element id
133143
* @return an instance of {@link ByName}
134144
*/
@@ -152,24 +162,25 @@ public static By custom(final String selector) {
152162
* This locator strategy is available only if OpenCV libraries and
153163
* Node.js bindings are installed on the server machine.
154164
*
165+
* @param b64Template base64-encoded template image string. Supported image formats are the same
166+
* as for OpenCV library.
167+
* @return an instance of {@link ByImage}
155168
* @see <a href="https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md">
156169
* The documentation on Image Comparison Features</a>
157170
* @see <a href="https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js">
158171
* The settings available for lookup fine-tuning</a>
159172
* @since Appium 1.8.2
160-
* @param b64Template base64-encoded template image string. Supported image formats are the same
161-
* as for OpenCV library.
162-
* @return an instance of {@link ByImage}
163173
*/
164174
public static By image(final String b64Template) {
165175
return new ByImage(b64Template);
166176
}
167177

168178
/**
169179
* This locator strategy is available in XCUITest Driver mode.
180+
*
170181
* @param iOSClassChainString is a valid class chain locator string.
171-
* See <a href="https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules">
172-
* the documentation</a> for more details
182+
*See <a href="https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules">
183+
* the documentation</a> for more details
173184
* @return an instance of {@link AppiumBy.ByIosClassChain}
174185
*/
175186
public static By iOSClassChain(final String iOSClassChainString) {
@@ -178,6 +189,7 @@ public static By iOSClassChain(final String iOSClassChainString) {
178189

179190
/**
180191
* This locator strategy is available in XCUITest Driver mode.
192+
*
181193
* @param iOSNsPredicateString is an iOS NsPredicate String
182194
* @return an instance of {@link AppiumBy.ByIosNsPredicate}
183195
*/
@@ -247,7 +259,8 @@ protected ByImage(String b64Template) {
247259

248260
public static class ByIosClassChain extends AppiumBy implements Serializable {
249261
protected ByIosClassChain(String locatorString) {
250-
super("-ios class chain", locatorString, "iOSClassChain");
262+
super("-ios class chain", locatorString,
263+
"iOSClassChain");
251264
}
252265
}
253266

@@ -259,9 +272,15 @@ protected ByIosNsPredicate(String locatorString) {
259272

260273
@Override
261274
public boolean equals(Object o) {
262-
if (this == o) return true;
263-
if (o == null || getClass() != o.getClass()) return false;
264-
if (!super.equals(o)) return false;
275+
if (this == o) {
276+
return true;
277+
}
278+
if (o == null || getClass() != o.getClass()) {
279+
return false;
280+
}
281+
if (!super.equals(o)) {
282+
return false;
283+
}
265284
AppiumBy appiumBy = (AppiumBy) o;
266285
return Objects.equals(remoteParameters, appiumBy.remoteParameters) && Objects.equals(locatorName, appiumBy.locatorName);
267286
}

src/main/java/io/appium/java_client/LocksDevice.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ default void unlockDevice() {
6464
final String extName = "mobile: unlock";
6565
try {
6666
//noinspection ConstantConditions
67-
if (!Boolean.parseBoolean(CommandExecutionHelper.executeScript(assertExtensionExists(extName), "mobile: isLocked"))) {
67+
if (!Boolean.parseBoolean(CommandExecutionHelper.executeScript(assertExtensionExists(extName),
68+
"mobile: isLocked"))) {
6869
return;
6970
}
7071
CommandExecutionHelper.executeScript(this, extName);

src/main/java/io/appium/java_client/internal/CapabilityHelpers.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.ArrayList;
2828
import java.util.List;
2929
import java.util.function.Function;
30+
3031
@NoArgsConstructor(access = AccessLevel.PRIVATE)
3132
public class CapabilityHelpers {
3233
public static final String APPIUM_PREFIX = "appium:";

src/main/java/io/appium/java_client/internal/ReflectionHelpers.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121
import org.openqa.selenium.WebDriverException;
2222

2323
import java.lang.reflect.Field;
24+
2425
@NoArgsConstructor(access = AccessLevel.PRIVATE)
2526
public class ReflectionHelpers {
2627

2728
/**
2829
* Sets the given value to a private instance field.
2930
*
30-
* @param cls The target class or a superclass.
31-
* @param target Target instance.
31+
* @param cls The target class or a superclass.
32+
* @param target Target instance.
3233
* @param fieldName Target field name.
33-
* @param newValue The value to be set.
34+
* @param newValue The value to be set.
3435
* @return The same instance for chaining.
3536
*/
3637
public static <T> T setPrivateFieldValue(Class<?> cls, T target, String fieldName, Object newValue) {
@@ -47,8 +48,8 @@ public static <T> T setPrivateFieldValue(Class<?> cls, T target, String fieldNam
4748
/**
4849
* Fetches the value of a private instance field.
4950
*
50-
* @param cls The target class or a superclass.
51-
* @param target Target instance.
51+
* @param cls The target class or a superclass.
52+
* @param target Target instance.
5253
* @param fieldName Target field name.
5354
* @param fieldType Field type.
5455
* @return The retrieved field value.

src/main/java/io/appium/java_client/pagefactory/OverrideWidgetReader.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import static io.appium.java_client.remote.MobilePlatform.ANDROID;
3131
import static io.appium.java_client.remote.MobilePlatform.IOS;
3232
import static io.appium.java_client.remote.MobilePlatform.WINDOWS;
33+
3334
@NoArgsConstructor(access = AccessLevel.PRIVATE)
3435
class OverrideWidgetReader {
3536
private static final Class<? extends Widget> EMPTY = Widget.class;
@@ -40,15 +41,15 @@ class OverrideWidgetReader {
4041

4142
@SuppressWarnings("unchecked")
4243
private static Class<? extends Widget> getConvenientClass(Class<? extends Widget> declaredClass,
43-
AnnotatedElement annotatedElement, String method) {
44+
AnnotatedElement annotatedElement, String method) {
4445
Class<? extends Widget> convenientClass;
4546
OverrideWidget overrideWidget = annotatedElement.getAnnotation(OverrideWidget.class);
4647

4748
try {
4849
if (overrideWidget == null || (convenientClass =
49-
(Class<? extends Widget>) OverrideWidget.class
50-
.getDeclaredMethod(method).invoke(overrideWidget))
51-
.equals(EMPTY)) {
50+
(Class<? extends Widget>) OverrideWidget.class
51+
.getDeclaredMethod(method).invoke(overrideWidget))
52+
.equals(EMPTY)) {
5253
convenientClass = declaredClass;
5354
}
5455
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
@@ -57,22 +58,22 @@ private static Class<? extends Widget> getConvenientClass(Class<? extends Widget
5758

5859
if (!declaredClass.isAssignableFrom(convenientClass)) {
5960
throw new IllegalArgumentException(
60-
new InstantiationException(declaredClass.getName()
61-
+ " is not assignable from "
62-
+ convenientClass.getName()));
61+
new InstantiationException(declaredClass.getName()
62+
+ " is not assignable from "
63+
+ convenientClass.getName()));
6364
}
6465

6566
return convenientClass;
6667

6768
}
6869

6970
static Class<? extends Widget> getDefaultOrHTMLWidgetClass(
70-
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement) {
71+
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement) {
7172
return getConvenientClass(declaredClass, annotatedElement, HTML);
7273
}
7374

7475
static Class<? extends Widget> getMobileNativeWidgetClass(Class<? extends Widget> declaredClass,
75-
AnnotatedElement annotatedElement, String platform) {
76+
AnnotatedElement annotatedElement, String platform) {
7677
String transformedPlatform = String.valueOf(platform).toUpperCase().trim();
7778

7879
if (ANDROID.equalsIgnoreCase(transformedPlatform)) {
@@ -91,26 +92,26 @@ static Class<? extends Widget> getMobileNativeWidgetClass(Class<? extends Widget
9192
}
9293

9394
private static Constructor<? extends Widget> getConstructorOfADefaultOrHTMLWidget(
94-
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement) {
95+
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement) {
9596
Class<? extends Widget> clazz =
96-
getDefaultOrHTMLWidgetClass(declaredClass, annotatedElement);
97+
getDefaultOrHTMLWidgetClass(declaredClass, annotatedElement);
9798
return findConvenientConstructor(clazz);
9899
}
99100

100101
private static Constructor<? extends Widget> getConstructorOfAMobileNativeWidgets(
101-
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement, String platform) {
102+
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement, String platform) {
102103
Class<? extends Widget> clazz =
103-
getMobileNativeWidgetClass(declaredClass, annotatedElement, platform);
104+
getMobileNativeWidgetClass(declaredClass, annotatedElement, platform);
104105
return findConvenientConstructor(clazz);
105106
}
106107

107108
protected static Map<ContentType, Constructor<? extends Widget>> read(
108-
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement, String platform) {
109+
Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement, String platform) {
109110
Map<ContentType, Constructor<? extends Widget>> result = new HashMap<>();
110111
result.put(ContentType.HTML_OR_DEFAULT,
111-
getConstructorOfADefaultOrHTMLWidget(declaredClass, annotatedElement));
112+
getConstructorOfADefaultOrHTMLWidget(declaredClass, annotatedElement));
112113
result.put(ContentType.NATIVE_MOBILE_SPECIFIC,
113-
getConstructorOfAMobileNativeWidgets(declaredClass, annotatedElement, platform));
114+
getConstructorOfAMobileNativeWidgets(declaredClass, annotatedElement, platform));
114115
return result;
115116
}
116117
}

0 commit comments

Comments
 (0)