diff --git a/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java index 6a1adbea5e7b6..8bf4ee5c9cf1c 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java @@ -48,6 +48,7 @@ import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertThrows; import static org.mockito.Mockito.mock; /** @@ -205,20 +206,23 @@ public void bulk(BulkRequest request, ActionListener listener) { } public void testIncrementalBulkMissingContent() { - assertThrows( - ElasticsearchParseException.class, - () -> new RestBulkAction( - Settings.EMPTY, - ClusterSettings.createBuiltInClusterSettings(), - new IncrementalBulkService(mock(Client.class), mock(IndexingPressure.class), MeterRegistry.NOOP) - ).handleRequest( - new FakeRestRequest.Builder(xContentRegistry()).withPath("my_index/_bulk") - .withContentLength(0) - .withBody(new FakeHttpBodyStream()) - .build(), - mock(RestChannel.class), - mock(NodeClient.class) - ) + assertEquals( + "request body is required", + assertThrows( + ElasticsearchParseException.class, + () -> new RestBulkAction( + Settings.EMPTY, + ClusterSettings.createBuiltInClusterSettings(), + new IncrementalBulkService(mock(Client.class), mock(IndexingPressure.class), MeterRegistry.NOOP) + ).handleRequest( + new FakeRestRequest.Builder(xContentRegistry()).withPath("my_index/_bulk") + .withContentLength(0) + .withBody(new FakeHttpBodyStream()) + .build(), + mock(RestChannel.class), + mock(NodeClient.class) + ) + ).getMessage() ); }