Skip to content

Commit b528ca5

Browse files
committed
Clean up some imports. No logical changes.
1 parent ac7535d commit b528ca5

38 files changed

+359
-314
lines changed

java/client/src/org/openqa/selenium/support/ui/SlowLoadableComponent.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
package org.openqa.selenium.support.ui;
1818

19-
import org.junit.Assert;
20-
2119
import static java.util.concurrent.TimeUnit.SECONDS;
20+
import static org.junit.Assert.fail;
2221

2322

2423
/**
@@ -91,7 +90,7 @@ private void waitFor() {
9190
try {
9291
Thread.sleep(sleepFor());
9392
} catch (InterruptedException e) {
94-
Assert.fail(e.getMessage());
93+
fail(e.getMessage());
9594
}
9695
}
9796

java/client/test/org/openqa/selenium/firefox/FirefoxDriverTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
import com.google.common.base.Throwables;
3838

39-
import org.junit.Assert;
4039
import org.junit.Test;
4140
import org.junit.runner.RunWith;
4241
import org.openqa.selenium.By;
@@ -457,7 +456,7 @@ public void quit() {
457456
}
458457

459458
public void assertOnRightPage() {
460-
Assert.assertEquals(url, myDriver.getCurrentUrl());
459+
assertEquals(url, myDriver.getCurrentUrl());
461460
}
462461
}
463462

java/client/test/org/openqa/selenium/firefox/internal/SocketLockTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
package org.openqa.selenium.firefox.internal;
1818

19-
import org.junit.Assert;
19+
import static org.junit.Assert.fail;
20+
2021
import org.junit.Before;
2122
import org.junit.Test;
2223
import org.openqa.selenium.WebDriverException;
@@ -62,7 +63,7 @@ public void attemptToReuseLocksFails() {
6263
lock.unlock();
6364
try {
6465
lock.lock(TimeUnit.SECONDS.toMillis(1));
65-
Assert.fail("Expected a SocketException to be thrown when reused");
66+
fail("Expected a SocketException to be thrown when reused");
6667
} catch (WebDriverException e) {
6768

6869
// Lock reuse not permitted; expected.

java/client/test/org/openqa/selenium/support/ThreadGuardTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
*/
1717
package org.openqa.selenium.support;
1818

19-
import org.junit.Assert;
19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotNull;
21+
import static org.junit.Assert.assertNull;
22+
2023
import org.junit.Test;
2124
import org.openqa.selenium.By;
2225
import org.openqa.selenium.StubDriver;
@@ -44,22 +47,22 @@ public void run() {
4447
});
4548
foo.start();
4649
foo.join();
47-
Assert.assertEquals(0, successes.get());
50+
assertEquals(0, successes.get());
4851
}
4952

5053
@Test
5154
public void testProtectSuccess() throws Exception {
5255
WebDriver actual = new PermissiveStubDriver();
5356
final WebDriver protect = ThreadGuard.protect(actual);
54-
Assert.assertNull(protect.findElement(By.id("foo")));
57+
assertNull(protect.findElement(By.id("foo")));
5558
}
5659

5760
@Test
5861
public void testInterfacesProxiedProperly() throws Exception {
5962
WebDriver actual = new PermissiveStubDriver();
6063
final WebDriver webdriver = ThreadGuard.protect(actual);
6164
HasTouchScreen hasTouchScreen = (HasTouchScreen) webdriver;
62-
Assert.assertNotNull(hasTouchScreen);
65+
assertNotNull(hasTouchScreen);
6366
}
6467

6568
class PermissiveStubDriver extends StubDriver {

java/server/test/org/openqa/grid/common/RegistrationRequestTest.java

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717

1818
package org.openqa.grid.common;
1919

20+
import static org.junit.Assert.assertEquals;
21+
import static org.junit.Assert.assertNotNull;
22+
import static org.junit.Assert.assertNotSame;
23+
import static org.junit.Assert.assertTrue;
2024
import static org.openqa.grid.common.RegistrationRequest.CLEAN_UP_CYCLE;
2125
import static org.openqa.grid.common.RegistrationRequest.REMOTE_HOST;
2226

23-
import org.junit.Assert;
2427
import org.junit.Test;
2528
import org.openqa.selenium.Platform;
2629
import org.openqa.selenium.remote.BrowserType;
@@ -44,13 +47,13 @@ public void getConfigAsTests() {
4447
req.setConfiguration(config);
4548

4649
int c = req.getConfigAsInt(CLEAN_UP_CYCLE, -1);
47-
Assert.assertTrue(c == 1);
50+
assertTrue(c == 1);
4851

4952
int e = req.getConfigAsInt("doesn't exist", 20);
50-
Assert.assertTrue(e == 20);
53+
assertTrue(e == 20);
5154

5255
String url2 = req.getConfigAsString(REMOTE_HOST);
53-
Assert.assertEquals(url2, url);
56+
assertEquals(url2, url);
5457
}
5558

5659
@Test
@@ -77,12 +80,12 @@ public void json() {
7780

7881
RegistrationRequest req2 = RegistrationRequest.getNewInstance(json);
7982

80-
Assert.assertEquals(req2.getId(), req.getId());
81-
Assert.assertEquals(req2.getName(), req.getName());
82-
Assert.assertEquals(req2.getDescription(), req.getDescription());
83+
assertEquals(req2.getId(), req.getId());
84+
assertEquals(req2.getName(), req.getName());
85+
assertEquals(req2.getDescription(), req.getDescription());
8386

84-
Assert.assertEquals(req2.getConfigAsString(name), req.getConfigAsString(name));
85-
Assert.assertEquals(req2.getCapabilities().size(), req.getCapabilities().size());
87+
assertEquals(req2.getConfigAsString(name), req.getConfigAsString(name));
88+
assertEquals(req2.getCapabilities().size(), req.getCapabilities().size());
8689

8790
}
8891

@@ -92,23 +95,23 @@ public void seleniumGrid1Request() {
9295
RegistrationRequest
9396
.getNewInstance("host=localhost&port=5000&environment=Firefox%3A+4%3B+MacOS+X%3A+10.6.7");
9497

95-
Assert.assertEquals(null, request.getId());
96-
Assert.assertEquals(null, request.getName());
97-
Assert.assertEquals(null, request.getDescription());
98+
assertEquals(null, request.getId());
99+
assertEquals(null, request.getName());
100+
assertEquals(null, request.getDescription());
98101

99102
// Verify the capabilities were set up properly.
100-
Assert.assertEquals(1, request.getCapabilities().size());
103+
assertEquals(1, request.getCapabilities().size());
101104
DesiredCapabilities caps = request.getCapabilities().get(0);
102105

103-
// Assert.assertEquals(Platform.LINUX.toString(), caps.get(CapabilityType.PLATFORM));
104-
Assert.assertEquals("Firefox: 4; MacOS X: 10.6.7",
105-
caps.getCapability(CapabilityType.BROWSER_NAME));
106+
// Assert.assertEquals(Platform.LINUX.toString(), caps.get(CapabilityType.PLATFORM));
107+
assertEquals("Firefox: 4; MacOS X: 10.6.7",
108+
caps.getCapability(CapabilityType.BROWSER_NAME));
106109

107110
// Verify the configuration was set up properly.
108-
Assert.assertEquals("http://localhost:5000", request.getConfiguration()
109-
.get(RegistrationRequest.REMOTE_HOST));
110-
Assert.assertEquals(SeleniumProtocol.Selenium.toString(), request.getConfiguration()
111-
.get(RegistrationRequest.SELENIUM_PROTOCOL));
111+
assertEquals("http://localhost:5000", request.getConfiguration()
112+
.get(RegistrationRequest.REMOTE_HOST));
113+
assertEquals(SeleniumProtocol.Selenium.toString(), request.getConfiguration()
114+
.get(RegistrationRequest.SELENIUM_PROTOCOL));
112115

113116
}
114117

@@ -120,42 +123,42 @@ public void basicCommandLineParam() {
120123
RegistrationRequest req =
121124
RegistrationRequest.build("-role", "rc", hubHost, "ABC", hubPort, "1234","-host","localhost");
122125

123-
Assert.assertEquals(GridRole.NODE, req.getRole());
124-
Assert.assertEquals("ABC", req.getConfiguration().get(RegistrationRequest.HUB_HOST));
125-
Assert.assertEquals(1234, req.getConfiguration().get(RegistrationRequest.HUB_PORT));
126+
assertEquals(GridRole.NODE, req.getRole());
127+
assertEquals("ABC", req.getConfiguration().get(RegistrationRequest.HUB_HOST));
128+
assertEquals(1234, req.getConfiguration().get(RegistrationRequest.HUB_PORT));
126129

127130
}
128131

129132
@Test
130133
public void commandLineParamDefault() {
131134
RegistrationRequest req = RegistrationRequest.build("-role", "rc");
132135
// the hub defaults to current IP.
133-
Assert.assertNotNull(req.getConfiguration().get(RegistrationRequest.HUB_HOST));
134-
Assert.assertEquals(4444, req.getConfiguration().get(RegistrationRequest.HUB_PORT));
136+
assertNotNull(req.getConfiguration().get(RegistrationRequest.HUB_HOST));
137+
assertEquals(4444, req.getConfiguration().get(RegistrationRequest.HUB_PORT));
135138
// the node defaults to current IP.
136-
Assert.assertNotNull(req.getConfiguration().get(RegistrationRequest.HOST));
137-
Assert.assertEquals(5555, req.getConfiguration().get(RegistrationRequest.PORT));
139+
assertNotNull(req.getConfiguration().get(RegistrationRequest.HOST));
140+
assertEquals(5555, req.getConfiguration().get(RegistrationRequest.PORT));
138141
}
139142

140143
@Test
141144
public void commandLineParamDefaultCapabilities() {
142145
String hubHost = "-" + RegistrationRequest.HUB_HOST;
143146
RegistrationRequest req = RegistrationRequest.build("-role", "rc", hubHost, "ABC","-host","localhost");
144-
Assert.assertEquals("ABC", req.getConfiguration().get(RegistrationRequest.HUB_HOST));
145-
Assert.assertNotSame(0, req.getCapabilities().size());
147+
assertEquals("ABC", req.getConfiguration().get(RegistrationRequest.HUB_HOST));
148+
assertNotSame(0, req.getCapabilities().size());
146149

147150
}
148151

149152
@Test
150153
public void registerParam() {
151154
String hubHost = "-" + RegistrationRequest.HUB_HOST;
152155
RegistrationRequest req = RegistrationRequest.build("-role", "rc", hubHost, "ABC","-host","localhost");
153-
Assert.assertEquals(true, req.getConfiguration().get(RegistrationRequest.AUTO_REGISTER));
156+
assertEquals(true, req.getConfiguration().get(RegistrationRequest.AUTO_REGISTER));
154157

155158
RegistrationRequest req2 =
156159
RegistrationRequest.build("-role", "rc", hubHost, "ABC", "-" +
157160
RegistrationRequest.AUTO_REGISTER, "false","-host","localhost");
158-
Assert.assertEquals(false, req2.getConfiguration().get(RegistrationRequest.AUTO_REGISTER));
161+
assertEquals(false, req2.getConfiguration().get(RegistrationRequest.AUTO_REGISTER));
159162

160163
}
161164

@@ -164,9 +167,9 @@ public void ensurePre2_9HubCompatibility() {
164167
RegistrationRequest req = RegistrationRequest.build("-role", "rc", "-host", "example.com", "-port", "5555");
165168

166169
// This is the configuration value for >= v2.9 hubs.
167-
Assert.assertEquals("http://example.com:5555", req.getConfigAsString(RegistrationRequest.REMOTE_HOST));
170+
assertEquals("http://example.com:5555", req.getConfigAsString(RegistrationRequest.REMOTE_HOST));
168171

169172
// This is the configuration value for < v2.9 hubs.
170-
Assert.assertEquals("http://example.com:5555", req.getConfigAsString("url"));
173+
assertEquals("http://example.com:5555", req.getConfigAsString("url"));
171174
}
172175
}

java/server/test/org/openqa/grid/e2e/misc/ConfigInheritanceTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
package org.openqa.grid.e2e.misc;
1919

20+
import static org.junit.Assert.assertEquals;
21+
2022
import org.junit.AfterClass;
21-
import org.junit.Assert;
2223
import org.junit.BeforeClass;
2324
import org.junit.Test;
2425
import org.openqa.grid.common.GridRole;
@@ -59,14 +60,14 @@ public static void prepare() throws Exception {
5960
@Test
6061
public void test() {
6162

62-
Assert.assertEquals(1, hub.getRegistry().getAllProxies().size());
63+
assertEquals(1, hub.getRegistry().getAllProxies().size());
6364
RemoteProxy p = hub.getRegistry().getAllProxies().iterator().next();
6465

65-
Assert.assertEquals(p.getConfig().get("A"), "valueA");
66-
Assert.assertEquals(p.getConfig().get("A2"), "proxyA2");
66+
assertEquals(p.getConfig().get("A"), "valueA");
67+
assertEquals(p.getConfig().get("A2"), "proxyA2");
6768

68-
Assert.assertEquals(p.getConfig().get("B"), 5);
69-
Assert.assertEquals(p.getConfig().get("B2"), 50);
69+
assertEquals(p.getConfig().get("B"), 5);
70+
assertEquals(p.getConfig().get("B2"), 50);
7071

7172

7273
}

java/server/test/org/openqa/grid/e2e/misc/Grid1HeartbeatTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717

1818
package org.openqa.grid.e2e.misc;
1919

20+
import static org.junit.Assert.assertEquals;
21+
2022
import org.apache.http.HttpHost;
2123
import org.apache.http.HttpRequest;
2224
import org.apache.http.HttpResponse;
2325
import org.apache.http.client.HttpClient;
2426
import org.apache.http.client.methods.HttpGet;
2527
import org.junit.AfterClass;
26-
import org.junit.Assert;
2728
import org.junit.BeforeClass;
2829
import org.junit.Test;
2930
import org.openqa.grid.common.GridRole;
@@ -66,8 +67,8 @@ public void testIsNotRegistered() throws Exception {
6667
BufferedReader body =
6768
new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
6869

69-
Assert.assertEquals(response.getStatusLine().getStatusCode(), 200);
70-
Assert.assertEquals(body.readLine(), "Hub : Not Registered");
70+
assertEquals(response.getStatusLine().getStatusCode(), 200);
71+
assertEquals(body.readLine(), "Hub : Not Registered");
7172
} finally {
7273
httpClientFactory.close();
7374
}
@@ -102,8 +103,8 @@ public void testIsRegistered() throws Exception {
102103
BufferedReader body =
103104
new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
104105

105-
Assert.assertEquals(response.getStatusLine().getStatusCode(), 200);
106-
Assert.assertEquals(body.readLine(), "Hub : OK");
106+
assertEquals(response.getStatusLine().getStatusCode(), 200);
107+
assertEquals(body.readLine(), "Hub : OK");
107108
} finally {
108109
httpClientFactory.close();
109110
}

java/server/test/org/openqa/grid/e2e/misc/HubRestart.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
package org.openqa.grid.e2e.misc;
1919

20+
import static org.junit.Assert.assertEquals;
21+
2022
import org.junit.AfterClass;
21-
import org.junit.Assert;
2223
import org.junit.BeforeClass;
2324
import org.junit.Test;
2425
import org.openqa.grid.common.GridRole;
@@ -64,7 +65,7 @@ public static void prepare() throws Exception {
6465
public void nodeRegisterAgain() throws Exception {
6566

6667
// every 5 sec, the node register themselves again.
67-
Assert.assertEquals(remote.getConfiguration().get(RegistrationRequest.REGISTER_CYCLE), 250);
68+
assertEquals(remote.getConfiguration().get(RegistrationRequest.REGISTER_CYCLE), 250);
6869
remote.startRegistrationProcess();
6970

7071
// should be up
@@ -80,7 +81,7 @@ public void nodeRegisterAgain() throws Exception {
8081
hub = new Hub(config);
8182
registry = hub.getRegistry();
8283
// should be empty
83-
Assert.assertEquals(registry.getAllProxies().size(), 0);
84+
assertEquals(registry.getAllProxies().size(), 0);
8485
hub.start();
8586

8687
// the node will appear again after 250 ms.

java/server/test/org/openqa/grid/e2e/misc/HubRestartNeg.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
package org.openqa.grid.e2e.misc;
1919

20+
import static org.junit.Assert.assertEquals;
21+
2022
import org.junit.AfterClass;
21-
import org.junit.Assert;
2223
import org.junit.BeforeClass;
2324
import org.junit.Test;
2425
import org.openqa.grid.common.GridRole;
@@ -65,7 +66,7 @@ public static void prepare() throws Exception {
6566
public void nodeRegisterAgain() throws Exception {
6667

6768
// every 5 sec, the node register themselves again.
68-
Assert.assertEquals(remote.getConfiguration().get(RegistrationRequest.REGISTER_CYCLE), -1);
69+
assertEquals(remote.getConfiguration().get(RegistrationRequest.REGISTER_CYCLE), -1);
6970
remote.startRegistrationProcess();
7071

7172
// should be up
@@ -81,7 +82,7 @@ public void nodeRegisterAgain() throws Exception {
8182
hub = new Hub(config);
8283
registry = hub.getRegistry();
8384
// should be empty
84-
Assert.assertEquals(registry.getAllProxies().size(), 0);
85+
assertEquals(registry.getAllProxies().size(), 0);
8586
hub.start();
8687

8788
// the node will appear again after 250 ms.

0 commit comments

Comments
 (0)