Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b33049e

Browse filesBrowse files
author
George Kankava
committed
multiple code improvements: squid:S1764, squid:S1192, squid:S2325
1 parent 0d86717 commit b33049e
Copy full SHA for b33049e

File tree

1 file changed

+20
-19
lines changed
Filter options

1 file changed

+20
-19
lines changed

‎src/main/java/org/sayem/webdriver/listeners/TestNGListener.java

Copy file name to clipboardExpand all lines: src/main/java/org/sayem/webdriver/listeners/TestNGListener.java
+20-19
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
*/
1111
public class TestNGListener implements IInvokedMethodListener2 {
1212

13+
private static final String BROWSER = "browser";
14+
private static final String SELENIUM_URL = "seleniumUrl";
1315
private String environment;
1416
private String browser;
1517
private String chrome;
1618
private String ie;
1719
private String firefox;
1820
private String safari;
1921

20-
2122
@Override
2223
public void beforeInvocation(IInvokedMethod method, ITestResult testResult, ITestContext context) {
2324

@@ -50,29 +51,29 @@ public void beforeInvocation(IInvokedMethod method, ITestResult testResult, ITes
5051
}
5152

5253
if (method.isTestMethod() && annotationPresent(method, Url.class) &&
53-
method.isTestMethod() && annotationPresent(method, Browser.class)) {
54-
System.setProperty("seleniumUrl", environment);
55-
System.setProperty("browser", browser);
54+
annotationPresent(method, Browser.class)) {
55+
System.setProperty(SELENIUM_URL, environment);
56+
System.setProperty(BROWSER, browser);
5657
} else if (method.isTestMethod() && annotationPresent(method, Url.class) &&
57-
method.isTestMethod() && annotationPresent(method, Chrome.class)) {
58-
System.setProperty("seleniumUrl", environment);
59-
System.setProperty("browser", chrome);
58+
annotationPresent(method, Chrome.class)) {
59+
System.setProperty(SELENIUM_URL, environment);
60+
System.setProperty(BROWSER, chrome);
6061
} else if (method.isTestMethod() && annotationPresent(method, Url.class) &&
61-
method.isTestMethod() && annotationPresent(method, Firefox.class)) {
62-
System.setProperty("seleniumUrl", environment);
63-
System.setProperty("browser", firefox);
62+
annotationPresent(method, Firefox.class)) {
63+
System.setProperty(SELENIUM_URL, environment);
64+
System.setProperty(BROWSER, firefox);
6465
} else if (method.isTestMethod() && annotationPresent(method, Url.class) &&
65-
method.isTestMethod() && annotationPresent(method, Safari.class)) {
66-
System.setProperty("seleniumUrl", environment);
67-
System.setProperty("browser", safari);
66+
annotationPresent(method, Safari.class)) {
67+
System.setProperty(SELENIUM_URL, environment);
68+
System.setProperty(BROWSER, safari);
6869
} else if (method.isTestMethod() && annotationPresent(method, Url.class) &&
69-
method.isTestMethod() && annotationPresent(method, InternetExplorer.class)) {
70-
System.setProperty("seleniumUrl", environment);
71-
System.setProperty("browser", ie);
70+
annotationPresent(method, InternetExplorer.class)) {
71+
System.setProperty(SELENIUM_URL, environment);
72+
System.setProperty(BROWSER, ie);
7273
} else if (method.isTestMethod() && annotationPresent(method, Url.class)) {
73-
System.setProperty("seleniumUrl", environment);
74+
System.setProperty(SELENIUM_URL, environment);
7475
} else if (method.isTestMethod() && annotationPresent(method, Browser.class)) {
75-
System.setProperty("browser", browser);
76+
System.setProperty(BROWSER, browser);
7677
}
7778
}
7879

@@ -91,7 +92,7 @@ public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
9192
// TODO Auto-generated method stub
9293
}
9394

94-
private boolean annotationPresent(IInvokedMethod method, Class<? extends Annotation> clazz) {
95+
private static boolean annotationPresent(IInvokedMethod method, Class<? extends Annotation> clazz) {
9596
return method.getTestMethod().getConstructorOrMethod().getMethod().isAnnotationPresent(clazz);
9697
}
9798
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.