@@ -75,7 +75,7 @@ public void testCoordinateLookups() {
7575 assertThat (coordinator .queue .size (), equalTo (5 ));
7676 assertThat (coordinator .getRemoteRequestsCurrent (), equalTo (1 ));
7777 assertThat (lookupFunction .capturedRequests .size (), equalTo (1 ));
78- assertThat (lookupFunction .capturedRequests .get ( 0 ).requests ().size (), equalTo (5 ));
78+ assertThat (lookupFunction .capturedRequests .getFirst ( ).requests ().size (), equalTo (5 ));
7979
8080 // Nothing should happen now, because there is an outstanding request and max number of requests has been set to 1:
8181 coordinator .coordinateLookups ();
@@ -93,7 +93,7 @@ public void testCoordinateLookups() {
9393 emptyResponse .decRef ();
9494 final MultiSearchResponse res1 = new MultiSearchResponse (responseItems , 1L );
9595 try {
96- lookupFunction .capturedConsumers .get ( 0 ).accept (res1 , null );
96+ lookupFunction .capturedConsumers .getFirst ( ).accept (res1 , null );
9797 assertThat (coordinator .queue .size (), equalTo (0 ));
9898 assertThat (coordinator .getRemoteRequestsCurrent (), equalTo (1 ));
9999 assertThat (lookupFunction .capturedRequests .size (), equalTo (2 ));
@@ -149,10 +149,10 @@ public void testCoordinateLookupsMultiSearchError() {
149149 assertThat (coordinator .queue .size (), equalTo (0 ));
150150 assertThat (coordinator .getRemoteRequestsCurrent (), equalTo (1 ));
151151 assertThat (lookupFunction .capturedRequests .size (), equalTo (1 ));
152- assertThat (lookupFunction .capturedRequests .get ( 0 ).requests ().size (), equalTo (5 ));
152+ assertThat (lookupFunction .capturedRequests .getFirst ( ).requests ().size (), equalTo (5 ));
153153
154154 RuntimeException e = new RuntimeException ();
155- lookupFunction .capturedConsumers .get ( 0 ).accept (null , e );
155+ lookupFunction .capturedConsumers .getFirst ( ).accept (null , e );
156156 assertThat (coordinator .queue .size (), equalTo (0 ));
157157 assertThat (coordinator .getRemoteRequestsCurrent (), equalTo (0 ));
158158 assertThat (lookupFunction .capturedRequests .size (), equalTo (1 ));
@@ -189,7 +189,7 @@ public void testCoordinateLookupsMultiSearchItemError() {
189189 assertThat (coordinator .queue .size (), equalTo (0 ));
190190 assertThat (coordinator .getRemoteRequestsCurrent (), equalTo (1 ));
191191 assertThat (lookupFunction .capturedRequests .size (), equalTo (1 ));
192- assertThat (lookupFunction .capturedRequests .get ( 0 ).requests ().size (), equalTo (5 ));
192+ assertThat (lookupFunction .capturedRequests .getFirst ( ).requests ().size (), equalTo (5 ));
193193
194194 RuntimeException e = new RuntimeException ();
195195 // Replying a response and that should trigger another coordination round
@@ -199,7 +199,7 @@ public void testCoordinateLookupsMultiSearchItemError() {
199199 }
200200 var res = new MultiSearchResponse (responseItems , 1L );
201201 try {
202- lookupFunction .capturedConsumers .get ( 0 ).accept (res , null );
202+ lookupFunction .capturedConsumers .getFirst ( ).accept (res , null );
203203 assertThat (coordinator .queue .size (), equalTo (0 ));
204204 assertThat (coordinator .getRemoteRequestsCurrent (), equalTo (0 ));
205205 assertThat (lookupFunction .capturedRequests .size (), equalTo (1 ));
@@ -213,7 +213,7 @@ public void testCoordinateLookupsMultiSearchItemError() {
213213 }
214214 }
215215
216- public void testNoBlockingWhenQueueing () throws Exception {
216+ public void testNoBlockingWhenQueueing () {
217217 MockLookupFunction lookupFunction = new MockLookupFunction ();
218218 // Only one request allowed in flight. Queue size maxed at 1.
219219 Coordinator coordinator = new Coordinator (lookupFunction , 1 , 1 , 1 );
@@ -256,11 +256,11 @@ public void testNoBlockingWhenQueueing() throws Exception {
256256 // Fulfill the captured consumer which will schedule the next item in the queue.
257257 var res = new MultiSearchResponse (new MultiSearchResponse .Item [] { new MultiSearchResponse .Item (emptySearchResponse (), null ) }, 1L );
258258 try {
259- lookupFunction .capturedConsumers .get ( 0 ).accept (res , null );
259+ lookupFunction .capturedConsumers .getFirst ( ).accept (res , null );
260260 // Ensure queue was drained and that the item in it was scheduled
261261 assertThat (coordinator .queue .size (), equalTo (0 ));
262262 assertThat (lookupFunction .capturedRequests .size (), equalTo (2 ));
263- assertThat (lookupFunction .capturedRequests .get (1 ).requests ().get ( 0 ), sameInstance (searchRequest ));
263+ assertThat (lookupFunction .capturedRequests .get (1 ).requests ().getFirst ( ), sameInstance (searchRequest ));
264264 } finally {
265265 res .decRef ();
266266 }
@@ -308,8 +308,8 @@ public ThreadPool threadPool() {
308308 String index = indices .get (i );
309309 assertThat (requests .get (i ).index (), equalTo (index ));
310310 assertThat (requests .get (i ).getMultiSearchRequest ().requests ().size (), equalTo (2 ));
311- assertThat (requests .get (i ).getMultiSearchRequest ().requests ().get ( 0 ).indices ().length , equalTo (1 ));
312- assertThat (requests .get (i ).getMultiSearchRequest ().requests ().get ( 0 ).indices ()[0 ], equalTo (index ));
311+ assertThat (requests .get (i ).getMultiSearchRequest ().requests ().getFirst ( ).indices ().length , equalTo (1 ));
312+ assertThat (requests .get (i ).getMultiSearchRequest ().requests ().getFirst ( ).indices ()[0 ], equalTo (index ));
313313 }
314314 }
315315
0 commit comments