19
19
20
20
import static org .junit .Assert .assertEquals ;
21
21
import static org .junit .Assert .assertTrue ;
22
- import static org .junit .Assert .assertNull ;
23
22
24
23
import org .junit .Before ;
25
24
import org .junit .Test ;
28
27
import org .openqa .grid .common .exception .GridException ;
29
28
import org .openqa .grid .internal .listeners .RegistrationListener ;
30
29
import org .openqa .grid .internal .mock .GridHelper ;
31
- import org .openqa .grid .internal .utils .configuration .GridHubConfiguration ;
32
30
import org .openqa .grid .internal .utils .configuration .GridNodeConfiguration ;
33
31
import org .openqa .grid .web .servlet .handler .RequestHandler ;
34
32
import org .openqa .selenium .remote .CapabilityType ;
@@ -44,7 +42,6 @@ public class RegistryTest {
44
42
45
43
private static final int TOTAL_THREADS = 100 ;
46
44
47
-
48
45
@ Test
49
46
public void addProxy () throws Exception {
50
47
GridRegistry registry = DefaultGridRegistry .newInstance ();
@@ -170,12 +167,10 @@ public void registerAtTheSameTime() throws InterruptedException {
170
167
171
168
try {
172
169
for (int i = 0 ; i < TOTAL_THREADS ; i ++) {
173
- new Thread (new Runnable () { // Thread safety reviewed
174
-
175
- public void run () {
176
- registry .add (new BaseRemoteProxy (req , registry ));
177
- latch .countDown ();
178
- }
170
+ // Thread safety reviewed
171
+ new Thread (() -> {
172
+ registry .add (new BaseRemoteProxy (req , registry ));
173
+ latch .countDown ();
179
174
}).start ();
180
175
}
181
176
@@ -220,12 +215,10 @@ public void registerAtTheSameTimeWithListener() throws InterruptedException {
220
215
221
216
try {
222
217
for (int i = 0 ; i < TOTAL_THREADS ; i ++) {
223
- new Thread (new Runnable () { // Thread safety reviewed
224
-
225
- public void run () {
226
- registry .add (new MyRemoteProxy (req , registry ));
227
- counter .incrementAndGet ();
228
- }
218
+ // Thread safety reviewed
219
+ new Thread (() -> {
220
+ registry .add (new MyRemoteProxy (req , registry ));
221
+ counter .incrementAndGet ();
229
222
}).start ();
230
223
}
231
224
while (counter .get () != TOTAL_THREADS ) {
@@ -237,11 +230,4 @@ public void run() {
237
230
registry .stop ();
238
231
}
239
232
}
240
-
241
- @ Test
242
- public void testLegacyNewInstanceCanReceiveNullHub () {
243
- GridRegistry registry = Registry .newInstance (null , new GridHubConfiguration ());
244
- assertNull (registry .getHub ());
245
- }
246
-
247
233
}
0 commit comments