Skip to content

Commit

Permalink
Test: Added more assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg committed Sep 10, 2014
1 parent 09db2e2 commit ab555e0
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -170,7 +170,7 @@ public void testParentWithMultipleBuckets() throws Exception {
TopHits topHits = childrenBucket.getAggregations().get("top_comments");
logger.info("total_hits={}", topHits.getHits().getTotalHits());
for (SearchHit searchHit : topHits.getHits()) {
logger.info("hit= {} {}", searchHit.sortValues()[0], searchHit.getId());
logger.info("hit= {} {} {}", searchHit.sortValues()[0], searchHit.getType(), searchHit.getId());
}
}

Expand All @@ -185,8 +185,10 @@ public void testParentWithMultipleBuckets() throws Exception {
assertThat(topHits.getHits().totalHits(), equalTo(2l));
assertThat(topHits.getHits().getAt(0).sortValues()[0].toString(), equalTo("a"));
assertThat(topHits.getHits().getAt(0).getId(), equalTo("a"));
assertThat(topHits.getHits().getAt(0).getType(), equalTo("comment"));
assertThat(topHits.getHits().getAt(1).sortValues()[0].toString(), equalTo("c"));
assertThat(topHits.getHits().getAt(1).getId(), equalTo("c"));
assertThat(topHits.getHits().getAt(1).getType(), equalTo("comment"));

categoryBucket = categoryTerms.getBucketByKey("b");
assertThat(categoryBucket.getKey(), equalTo("b"));
Expand All @@ -198,6 +200,7 @@ public void testParentWithMultipleBuckets() throws Exception {
topHits = childrenBucket.getAggregations().get("top_comments");
assertThat(topHits.getHits().totalHits(), equalTo(1l));
assertThat(topHits.getHits().getAt(0).getId(), equalTo("c"));
assertThat(topHits.getHits().getAt(0).getType(), equalTo("comment"));

categoryBucket = categoryTerms.getBucketByKey("c");
assertThat(categoryBucket.getKey(), equalTo("c"));
Expand All @@ -209,6 +212,7 @@ public void testParentWithMultipleBuckets() throws Exception {
topHits = childrenBucket.getAggregations().get("top_comments");
assertThat(topHits.getHits().totalHits(), equalTo(1l));
assertThat(topHits.getHits().getAt(0).getId(), equalTo("c"));
assertThat(topHits.getHits().getAt(0).getType(), equalTo("comment"));
}

private static final class Control {
Expand Down

0 comments on commit ab555e0

Please sign in to comment.