4242import static org .hamcrest .Matchers .empty ;
4343import static org .hamcrest .Matchers .equalTo ;
4444import static org .hamcrest .Matchers .hasSize ;
45+ import static org .mockito .ArgumentMatchers .anyBoolean ;
46+ import static org .mockito .ArgumentMatchers .anyInt ;
47+ import static org .mockito .ArgumentMatchers .anyLong ;
4548import static org .mockito .Mockito .mock ;
49+ import static org .mockito .Mockito .when ;
4650
4751/**
4852 * Tests for {@link RestBulkAction}.
@@ -224,10 +228,12 @@ public void next() {
224228 .build ();
225229 FakeRestChannel channel = new FakeRestChannel (request , randomBoolean (), 1 );
226230
227- RestBulkAction .ChunkHandler chunkHandler = new RestBulkAction .ChunkHandler (
228- true ,
229- request ,
230- () -> new IncrementalBulkService .Handler (null , null , null , null , null ) {
231+ IndexingPressure indexingPressure = mock (IndexingPressure .class );
232+ when (indexingPressure .markCoordinatingOperationStarted (anyInt (), anyLong (), anyBoolean ())).thenReturn (
233+ mock (IndexingPressure .Coordinating .class )
234+ );
235+ RestBulkAction .ChunkHandler chunkHandler = new RestBulkAction .ChunkHandler (true , request , () -> {
236+ return new IncrementalBulkService .Handler (null , indexingPressure , null , null , null ) {
231237
232238 @ Override
233239 public void addItems (List <DocWriteRequest <?>> items , Releasable releasable , Runnable nextItems ) {
@@ -241,8 +247,8 @@ public void lastItems(List<DocWriteRequest<?>> items, Releasable releasable, Act
241247 docs .addAll (items );
242248 isLast .set (true );
243249 }
244- }
245- );
250+ };
251+ } );
246252
247253 chunkHandler .accept (channel );
248254 ReleasableBytesReference r1 = new ReleasableBytesReference (new BytesArray ("{\" index\" :{\" _index\" :\" index_name\" }}\n " ), () -> {});
0 commit comments