From 7c20603071804f1d8b2b49eb1d85f4980408a01e Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Tue, 10 Sep 2013 10:12:37 +0200 Subject: [PATCH] use ElasticsearchAssertions to get info on shard failures --- .../hamcrest/ElasticsearchAssertions.java | 9 + .../search/geo/GeoDistanceTests.java | 163 +++++------------- 2 files changed, 55 insertions(+), 117 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java b/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java index a6d8e9689b8..21a2ccf4b5b 100644 --- a/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java +++ b/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java @@ -114,6 +114,15 @@ public class ElasticsearchAssertions { } assertThat("Expected ids: " + Arrays.toString(idsSet.toArray(new String[0])) + " in the result - result size differs." + shardStatus, idsSet.size(), equalTo(0)); } + + public static void assertOrderedSearchHits(SearchResponse searchResponse, String... ids) { + String shardStatus = formatShardStatus(searchResponse); + assertThat("Expected different hit count. " + shardStatus, searchResponse.getHits().hits().length, equalTo(ids.length)); + for (int i=0; i