|
48 | 48 | import static org.hamcrest.Matchers.empty;
|
49 | 49 | import static org.hamcrest.Matchers.equalTo;
|
50 | 50 | import static org.hamcrest.Matchers.hasSize;
|
| 51 | +import static org.junit.Assert.assertThrows; |
51 | 52 | import static org.mockito.Mockito.mock;
|
52 | 53 |
|
53 | 54 | /**
|
@@ -205,20 +206,23 @@ public void bulk(BulkRequest request, ActionListener<BulkResponse> listener) {
|
205 | 206 | }
|
206 | 207 |
|
207 | 208 | 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() |
222 | 226 | );
|
223 | 227 | }
|
224 | 228 |
|
|
0 commit comments