Skip to content

Commit 05ab741

Browse files
committed
fixed code smell appium#4
1 parent c160eba commit 05ab741

File tree

2 files changed

+67
-59
lines changed

2 files changed

+67
-59
lines changed

src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AndroidApp.java

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,7 @@
55

66
import java.util.List;
77

8-
public class AndroidApp implements ExtendedApp {
9-
10-
public static String ANDROID_DEFAULT_WIDGET_LOCATOR = "SOME_ANDROID_DEFAULT_LOCATOR";
11-
12-
public static String ANDROID_EXTERNALLY_DEFINED_WIDGET_LOCATOR = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR";
13-
14-
@AndroidFindBy(uiAutomator = "SOME_ANDROID_DEFAULT_LOCATOR")
15-
private DefaultAndroidWidget singleAndroidWidget;
16-
17-
@AndroidFindBy(uiAutomator = "SOME_ANDROID_DEFAULT_LOCATOR")
18-
private List<DefaultAndroidWidget> multipleAndroidWidgets;
19-
20-
/**
21-
* This class is annotated by {@link AndroidFindBy}
22-
* This field was added to check that locator is created correctly according to current platform
23-
* and current automation.
24-
*/
25-
private AnnotatedAndroidWidget singleAnnotatedAndroidWidget;
26-
27-
/**
28-
* This class is annotated by {@link AndroidFindBy}
29-
* This field was added to check that locator is created correctly according to current platform
30-
* and current automation.
31-
*/
32-
private List<AnnotatedAndroidWidget> multipleAnnotatedAndroidWidgets;
33-
34-
/**
35-
* This class is not annotated by {@link AndroidFindBy}
36-
* But the superclass is annotated by these annotations. This field was added to check that locator is
37-
* created correctly according to current platform and current automation.
38-
*/
39-
private ExtendedAndroidWidget singleExtendedAndroidWidget;
40-
41-
/**
42-
* This class is not annotated by {@link AndroidFindBy}
43-
* But the superclass is annotated by these annotations. This field was added to check that locator is
44-
* created correctly according to current platform and current automation.
45-
*/
46-
private List<ExtendedAndroidWidget> multipleExtendedAndroidWidgets;
47-
48-
/**
49-
* The superclass is annotated by {@link AndroidFindBy}
50-
* However there is the field which is annotated by this annotations.
51-
* This field was added to check that locator is
52-
* created correctly according to current platform and current automation and
53-
* annotations that mark the field.
54-
*/
55-
@AndroidFindBy(uiAutomator = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR")
56-
private ExtendedAndroidWidget singleOverriddenAndroidWidget;
57-
58-
/**
59-
* The superclass is annotated by {@link AndroidFindBy}
60-
* However there is the field which is annotated by this annotations.
61-
* This field was added to check that locator is
62-
* created correctly according to current platform and current automation and
63-
* annotations that mark the field.
64-
*/
65-
@AndroidFindBy(uiAutomator = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR")
66-
private List<ExtendedAndroidWidget> multipleOverriddenAndroidWidgets;
8+
public class AndroidApp extends WidgetManager implements ExtendedApp {
679

6810
@Override
6911
public DefaultAndroidWidget getWidget() {
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package io.appium.java_client.pagefactory_tests.widget.tests.android;
2+
3+
import io.appium.java_client.pagefactory.AndroidFindBy;
4+
5+
import java.util.List;
6+
7+
public class WidgetManager {
8+
9+
public static String ANDROID_DEFAULT_WIDGET_LOCATOR = "SOME_ANDROID_DEFAULT_LOCATOR";
10+
11+
public static String ANDROID_EXTERNALLY_DEFINED_WIDGET_LOCATOR = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR";
12+
13+
@AndroidFindBy(uiAutomator = "SOME_ANDROID_DEFAULT_LOCATOR")
14+
protected DefaultAndroidWidget singleAndroidWidget;
15+
16+
@AndroidFindBy(uiAutomator = "SOME_ANDROID_DEFAULT_LOCATOR")
17+
protected List<DefaultAndroidWidget> multipleAndroidWidgets;
18+
19+
/**
20+
* This class is annotated by {@link AndroidFindBy}
21+
* This field was added to check that locator is created correctly according to current platform
22+
* and current automation.
23+
*/
24+
protected AnnotatedAndroidWidget singleAnnotatedAndroidWidget;
25+
26+
/**
27+
* This class is annotated by {@link AndroidFindBy}
28+
* This field was added to check that locator is created correctly according to current platform
29+
* and current automation.
30+
*/
31+
protected List<AnnotatedAndroidWidget> multipleAnnotatedAndroidWidgets;
32+
33+
/**
34+
* This class is not annotated by {@link AndroidFindBy}
35+
* But the superclass is annotated by these annotations. This field was added to check that locator is
36+
* created correctly according to current platform and current automation.
37+
*/
38+
protected ExtendedAndroidWidget singleExtendedAndroidWidget;
39+
40+
/**
41+
* This class is not annotated by {@link AndroidFindBy}
42+
* But the superclass is annotated by these annotations. This field was added to check that locator is
43+
* created correctly according to current platform and current automation.
44+
*/
45+
protected List<ExtendedAndroidWidget> multipleExtendedAndroidWidgets;
46+
47+
/**
48+
* The superclass is annotated by {@link AndroidFindBy}
49+
* However there is the field which is annotated by this annotations.
50+
* This field was added to check that locator is
51+
* created correctly according to current platform and current automation and
52+
* annotations that mark the field.
53+
*/
54+
@AndroidFindBy(uiAutomator = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR")
55+
protected ExtendedAndroidWidget singleOverriddenAndroidWidget;
56+
57+
/**
58+
* The superclass is annotated by {@link AndroidFindBy}
59+
* However there is the field which is annotated by this annotations.
60+
* This field was added to check that locator is
61+
* created correctly according to current platform and current automation and
62+
* annotations that mark the field.
63+
*/
64+
@AndroidFindBy(uiAutomator = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR")
65+
protected List<ExtendedAndroidWidget> multipleOverriddenAndroidWidgets;
66+
}

0 commit comments

Comments
 (0)