Skip to content

Commit 2d54515

Browse files
fix more tests
1 parent b6bbb1b commit 2d54515

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/pivot/AggregationResultUtilsTests.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,16 +1004,12 @@ public void describeTo(Description description) {
10041004
}
10051005

10061006
public static SingleBucketAggregation createSingleBucketAgg(String name, long docCount, InternalAggregation... subAggregations) {
1007-
SingleBucketAggregation agg = mock(SingleBucketAggregation.class);
1008-
when(agg.getDocCount()).thenReturn(docCount);
1009-
when(agg.getName()).thenReturn(name);
1010-
if (subAggregations != null) {
1011-
InternalAggregations subAggs = InternalAggregations.from(List.of(subAggregations));
1012-
when(agg.getAggregations()).thenReturn(subAggs);
1013-
} else {
1014-
when(agg.getAggregations()).thenReturn(null);
1015-
}
1016-
return agg;
1007+
return new SingleBucketAggregation(
1008+
name,
1009+
docCount,
1010+
subAggregations == null ? null : InternalAggregations.from(List.of(subAggregations)),
1011+
null
1012+
);
10171013
}
10181014

10191015
public void testSingleBucketAggExtractor() {

0 commit comments

Comments
 (0)