summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorTests.java')
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorTests.java60
1 files changed, 32 insertions, 28 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorTests.java
index 48b0b115e8..3408742160 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorTests.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregatorTests.java
@@ -62,13 +62,14 @@ public class MinAggregatorTests extends AggregatorTestCase {
MinAggregationBuilder aggregationBuilder = new MinAggregationBuilder("_name").field("number");
MappedFieldType fieldType = new NumberFieldMapper.NumberFieldType(NumberFieldMapper.NumberType.LONG);
fieldType.setName("number");
- try (MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType)) {
- aggregator.preCollection();
- indexSearcher.search(new MatchAllDocsQuery(), aggregator);
- aggregator.postCollection();
- InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
- assertEquals(-1.0, result.getValue(), 0);
- }
+
+ MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
+ aggregator.preCollection();
+ indexSearcher.search(new MatchAllDocsQuery(), aggregator);
+ aggregator.postCollection();
+ InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
+ assertEquals(-1.0, result.getValue(), 0);
+
indexReader.close();
directory.close();
}
@@ -96,13 +97,14 @@ public class MinAggregatorTests extends AggregatorTestCase {
MinAggregationBuilder aggregationBuilder = new MinAggregationBuilder("_name").field("number");
MappedFieldType fieldType = new NumberFieldMapper.NumberFieldType(NumberFieldMapper.NumberType.LONG);
fieldType.setName("number");
- try (MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType)) {
- aggregator.preCollection();
- indexSearcher.search(new MatchAllDocsQuery(), aggregator);
- aggregator.postCollection();
- InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
- assertEquals(-1.0, result.getValue(), 0);
- }
+
+ MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
+ aggregator.preCollection();
+ indexSearcher.search(new MatchAllDocsQuery(), aggregator);
+ aggregator.postCollection();
+ InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
+ assertEquals(-1.0, result.getValue(), 0);
+
indexReader.close();
directory.close();
}
@@ -127,13 +129,14 @@ public class MinAggregatorTests extends AggregatorTestCase {
MinAggregationBuilder aggregationBuilder = new MinAggregationBuilder("_name").field("number2");
MappedFieldType fieldType = new NumberFieldMapper.NumberFieldType(NumberFieldMapper.NumberType.LONG);
fieldType.setName("number2");
- try (MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType)) {
- aggregator.preCollection();
- indexSearcher.search(new MatchAllDocsQuery(), aggregator);
- aggregator.postCollection();
- InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
- assertEquals(Double.POSITIVE_INFINITY, result.getValue(), 0);
- }
+
+ MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
+ aggregator.preCollection();
+ indexSearcher.search(new MatchAllDocsQuery(), aggregator);
+ aggregator.postCollection();
+ InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
+ assertEquals(Double.POSITIVE_INFINITY, result.getValue(), 0);
+
indexReader.close();
directory.close();
}
@@ -149,13 +152,14 @@ public class MinAggregatorTests extends AggregatorTestCase {
MinAggregationBuilder aggregationBuilder = new MinAggregationBuilder("_name").field("number");
MappedFieldType fieldType = new NumberFieldMapper.NumberFieldType(NumberFieldMapper.NumberType.LONG);
fieldType.setName("number");
- try (MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType)) {
- aggregator.preCollection();
- indexSearcher.search(new MatchAllDocsQuery(), aggregator);
- aggregator.postCollection();
- InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
- assertEquals(Double.POSITIVE_INFINITY, result.getValue(), 0);
- }
+
+ MinAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
+ aggregator.preCollection();
+ indexSearcher.search(new MatchAllDocsQuery(), aggregator);
+ aggregator.postCollection();
+ InternalMin result = (InternalMin) aggregator.buildAggregation(0L);
+ assertEquals(Double.POSITIVE_INFINITY, result.getValue(), 0);
+
indexReader.close();
directory.close();
}