Skip to content

Commit feb03da

Browse files
committed
test:nit incremental bulk missing content
1 parent 36de99b commit feb03da

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import static org.hamcrest.Matchers.empty;
4848
import static org.hamcrest.Matchers.equalTo;
4949
import static org.hamcrest.Matchers.hasSize;
50+
import static org.hamcrest.Matchers.instanceOf;
5051
import static org.mockito.Mockito.mock;
5152

5253
/**
@@ -204,9 +205,8 @@ public void bulk(BulkRequest request, ActionListener<BulkResponse> listener) {
204205
}
205206

206207
public void testIncrementalBulkMissingContent() {
207-
assertThrows(
208-
ElasticsearchParseException.class,
209-
() -> new RestBulkAction(
208+
try {
209+
new RestBulkAction(
210210
Settings.EMPTY,
211211
ClusterSettings.createBuiltInClusterSettings(),
212212
new IncrementalBulkService(mock(Client.class), mock(IndexingPressure.class), MeterRegistry.NOOP)
@@ -217,8 +217,12 @@ public void testIncrementalBulkMissingContent() {
217217
.build(),
218218
mock(RestChannel.class),
219219
mock(NodeClient.class)
220-
)
221-
);
220+
);
221+
assert false : "must throw";
222+
} catch (Exception e) {
223+
assertThat(e, instanceOf(ElasticsearchParseException.class));
224+
assertEquals("request body is required", e.getMessage());
225+
}
222226
}
223227

224228
public void testIncrementalParsing() {

0 commit comments

Comments
 (0)