From 9c63abde049e2e20f3d737e415c2bd9e634966a0 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 19 Aug 2014 16:34:22 +0200 Subject: [PATCH] [TEST] Added more assertions --- .../search/aggregations/bucket/ChildrenTests.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java index ccf8ba1d5ec..725e315bab5 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java @@ -173,6 +173,7 @@ public class ChildrenTests extends ElasticsearchIntegrationTest { assertThat(childrenBucket.getName(), equalTo("to_comment")); assertThat(childrenBucket.getDocCount(), equalTo(2l)); TopHits topHits = childrenBucket.getAggregations().get("top_comments"); + assertThat(topHits.getHits().totalHits(), equalTo(2l)); assertThat(topHits.getHits().getAt(0).getId(), equalTo("a")); assertThat(topHits.getHits().getAt(1).getId(), equalTo("c")); @@ -183,6 +184,9 @@ public class ChildrenTests extends ElasticsearchIntegrationTest { childrenBucket = categoryBucket.getAggregations().get("to_comment"); assertThat(childrenBucket.getName(), equalTo("to_comment")); assertThat(childrenBucket.getDocCount(), equalTo(1l)); + topHits = childrenBucket.getAggregations().get("top_comments"); + assertThat(topHits.getHits().totalHits(), equalTo(1l)); + assertThat(topHits.getHits().getAt(0).getId(), equalTo("c")); categoryBucket = categoryTerms.getBucketByKey("c"); assertThat(categoryBucket.getKey(), equalTo("c")); @@ -191,6 +195,9 @@ public class ChildrenTests extends ElasticsearchIntegrationTest { childrenBucket = categoryBucket.getAggregations().get("to_comment"); assertThat(childrenBucket.getName(), equalTo("to_comment")); assertThat(childrenBucket.getDocCount(), equalTo(1l)); + topHits = childrenBucket.getAggregations().get("top_comments"); + assertThat(topHits.getHits().totalHits(), equalTo(1l)); + assertThat(topHits.getHits().getAt(0).getId(), equalTo("c")); } private static final class Control {