[TEST] Added more assertions

This commit is contained in:
Martijn van Groningen 2014-08-19 16:34:22 +02:00
parent 0f63e0a8da
commit 9c63abde04
1 changed files with 7 additions and 0 deletions

View File

@ -173,6 +173,7 @@ public class ChildrenTests extends ElasticsearchIntegrationTest {
assertThat(childrenBucket.getName(), equalTo("to_comment")); assertThat(childrenBucket.getName(), equalTo("to_comment"));
assertThat(childrenBucket.getDocCount(), equalTo(2l)); assertThat(childrenBucket.getDocCount(), equalTo(2l));
TopHits topHits = childrenBucket.getAggregations().get("top_comments"); 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(0).getId(), equalTo("a"));
assertThat(topHits.getHits().getAt(1).getId(), equalTo("c")); assertThat(topHits.getHits().getAt(1).getId(), equalTo("c"));
@ -183,6 +184,9 @@ public class ChildrenTests extends ElasticsearchIntegrationTest {
childrenBucket = categoryBucket.getAggregations().get("to_comment"); childrenBucket = categoryBucket.getAggregations().get("to_comment");
assertThat(childrenBucket.getName(), equalTo("to_comment")); assertThat(childrenBucket.getName(), equalTo("to_comment"));
assertThat(childrenBucket.getDocCount(), equalTo(1l)); 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"); categoryBucket = categoryTerms.getBucketByKey("c");
assertThat(categoryBucket.getKey(), equalTo("c")); assertThat(categoryBucket.getKey(), equalTo("c"));
@ -191,6 +195,9 @@ public class ChildrenTests extends ElasticsearchIntegrationTest {
childrenBucket = categoryBucket.getAggregations().get("to_comment"); childrenBucket = categoryBucket.getAggregations().get("to_comment");
assertThat(childrenBucket.getName(), equalTo("to_comment")); assertThat(childrenBucket.getName(), equalTo("to_comment"));
assertThat(childrenBucket.getDocCount(), equalTo(1l)); 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 { private static final class Control {