[TEST] add test to verify that no aggs have been forgotten in AggregationsTests

This commit is contained in:
javanna 2017-05-09 21:23:00 +02:00 committed by Luca Cavanna
parent c5bdbecc64
commit 37dc165e7f
1 changed files with 10 additions and 0 deletions

View File

@ -58,6 +58,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static java.util.Collections.singletonMap;
@ -116,6 +118,14 @@ public class AggregationsTests extends ESTestCase {
}
}
public void testAllAggsAreBeingTested() {
assertEquals(InternalAggregationTestCase.getNamedXContents().size(), aggsTests.size());
Set<String> aggs = aggsTests.stream().map((testCase) -> testCase.createTestInstance().getType()).collect(Collectors.toSet());
for (NamedXContentRegistry.Entry entry : InternalAggregationTestCase.getNamedXContents()) {
assertTrue(aggs.contains(entry.name.getPreferredName()));
}
}
public void testFromXContent() throws IOException {
XContentType xContentType = randomFrom(XContentType.values());
final ToXContent.Params params = new ToXContent.MapParams(singletonMap(RestSearchAction.TYPED_KEYS_PARAM, "true"));