Skip to content

Commit ac7bfcc

Browse files
committed
Tests: Extend InternalStatsTests
Currently we don't test for count = 0 which will make a difference when adding tests for parsing for the high level rest client. Also min/max/sum should also be tested with negative values and on a larger range.
1 parent 446124b commit ac7bfcc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalStatsTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ public class InternalStatsTests extends InternalAggregationTestCase<InternalStat
3232
@Override
3333
protected InternalStats createTestInstance(String name, List<PipelineAggregator> pipelineAggregators,
3434
Map<String, Object> metaData) {
35-
long count = randomIntBetween(1, 50);
36-
double[] minMax = new double[2];
37-
minMax[0] = randomDouble();
38-
minMax[0] = randomDouble();
39-
double sum = randomDoubleBetween(0, 100, true);
40-
return new InternalStats(name, count, sum, minMax[0], minMax[1], DocValueFormat.RAW,
41-
pipelineAggregators, Collections.emptyMap());
35+
long count = randomIntBetween(0, 50);
36+
double min = randomDoubleBetween(-1000, 1000, false);
37+
double max = randomDoubleBetween(-1000, 1000, false);
38+
double sum = randomDoubleBetween(-1000, 1000, false);
39+
DocValueFormat format = randomNumericDocValueFormat();
40+
return new InternalStats(name, count, sum, min, max, format, pipelineAggregators, Collections.emptyMap());
4241
}
4342

4443
@Override

0 commit comments

Comments
 (0)