Skip to content

Commit b2b0cac

Browse files
committed
inline utility and clearer exception message
1 parent c1b9451 commit b2b0cac

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

server/src/test/java/org/elasticsearch/ingest/SimulateIngestServiceTests.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ private static <K, V> Map<K, V> newHashMap(K key, V value) {
4949
return map;
5050
}
5151

52-
private static <K, V> Map<K, V> emptyMutableHashMap() {
53-
return new HashMap<>(0);
54-
}
55-
5652
public void testGetPipeline() {
5753
PipelineConfiguration pipelineConfiguration = new PipelineConfiguration("pipeline1", new BytesArray("""
5854
{"processors": [{"processor1" : {}}]}"""), XContentType.JSON);
@@ -130,14 +126,14 @@ public void testRethrowingOfElasticParseExceptionFromProcessors() {
130126
{"processors": []}"""), XContentType.JSON);
131127
final IngestMetadata ingestMetadata = new IngestMetadata(Map.of("pipeline1", pipelineConfiguration));
132128
final Processor.Factory factoryThatThrowsElasticParseException = (factory, tag, description, config, projectId) -> {
133-
throw new ElasticsearchParseException("house: it's never lupus");
129+
throw new ElasticsearchParseException("exception to be caught");
134130
};
135131
final Map<String, Processor.Factory> processors = Map.of("parse_exception_processor", factoryThatThrowsElasticParseException);
136132
final var projectId = randomProjectIdOrDefault();
137133
IngestService ingestService = createWithProcessors(projectId, processors);
138134
ingestService.innerUpdatePipelines(projectId, ingestMetadata);
139135
SimulateBulkRequest simulateBulkRequest = new SimulateBulkRequest(
140-
newHashMap("pipeline1", newHashMap("processors", List.of(Map.of("parse_exception_processor", emptyMutableHashMap())))),
136+
newHashMap("pipeline1", newHashMap("processors", List.of(Map.of("parse_exception_processor", new HashMap<>(0))))),
141137
Map.of(),
142138
Map.of(),
143139
Map.of()
@@ -147,7 +143,7 @@ public void testRethrowingOfElasticParseExceptionFromProcessors() {
147143
ElasticsearchParseException.class,
148144
() -> new SimulateIngestService(ingestService, simulateBulkRequest)
149145
);
150-
assertThat(ex.getMessage(), is("house: it's never lupus"));
146+
assertThat(ex.getMessage(), is("exception to be caught"));
151147
}
152148

153149
private static IngestService createWithProcessors(ProjectId projectId, Map<String, Processor.Factory> processors) {

0 commit comments

Comments
 (0)