Skip to content

Commit 2364939

Browse files
authored
Test:nit incremental bulk missing content (#133855)
1 parent 049599c commit 2364939

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import static org.hamcrest.Matchers.empty;
4949
import static org.hamcrest.Matchers.equalTo;
5050
import static org.hamcrest.Matchers.hasSize;
51+
import static org.junit.Assert.assertThrows;
5152
import static org.mockito.Mockito.mock;
5253

5354
/**
@@ -205,20 +206,23 @@ public void bulk(BulkRequest request, ActionListener<BulkResponse> listener) {
205206
}
206207

207208
public void testIncrementalBulkMissingContent() {
208-
assertThrows(
209-
ElasticsearchParseException.class,
210-
() -> new RestBulkAction(
211-
Settings.EMPTY,
212-
ClusterSettings.createBuiltInClusterSettings(),
213-
new IncrementalBulkService(mock(Client.class), mock(IndexingPressure.class), MeterRegistry.NOOP)
214-
).handleRequest(
215-
new FakeRestRequest.Builder(xContentRegistry()).withPath("my_index/_bulk")
216-
.withContentLength(0)
217-
.withBody(new FakeHttpBodyStream())
218-
.build(),
219-
mock(RestChannel.class),
220-
mock(NodeClient.class)
221-
)
209+
assertEquals(
210+
"request body is required",
211+
assertThrows(
212+
ElasticsearchParseException.class,
213+
() -> new RestBulkAction(
214+
Settings.EMPTY,
215+
ClusterSettings.createBuiltInClusterSettings(),
216+
new IncrementalBulkService(mock(Client.class), mock(IndexingPressure.class), MeterRegistry.NOOP)
217+
).handleRequest(
218+
new FakeRestRequest.Builder(xContentRegistry()).withPath("my_index/_bulk")
219+
.withContentLength(0)
220+
.withBody(new FakeHttpBodyStream())
221+
.build(),
222+
mock(RestChannel.class),
223+
mock(NodeClient.class)
224+
)
225+
).getMessage()
222226
);
223227
}
224228

0 commit comments

Comments
 (0)