From 00c13532a91b947eaac05fb0d53596d51e11fa9f Mon Sep 17 00:00:00 2001
From: Simon Willnauer <simonw@apache.org>
Date: Thu, 6 Jun 2013 00:53:52 +0200
Subject: [PATCH] report details if shard response has failed shards

---
 .../integration/search/sort/SimpleSortTests.java    | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java b/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java
index 144f621cb69..8f0ce355f35 100644
--- a/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java
+++ b/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java
@@ -33,6 +33,8 @@ import static org.hamcrest.Matchers.closeTo;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.nullValue;
+
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -805,16 +807,14 @@ public class SimpleSortTests extends AbstractSharedClusterTest {
                 .field("i_value", -1)
                 .field("d_value", -1.1)
                 .endObject()).execute().actionGet();
-
-        client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
-
+        ensureYellow();
         logger.info("--> sort with an unmapped field, verify it fails");
         try {
-                client().prepareSearch()
+                SearchResponse result = client().prepareSearch()
                     .setQuery(matchAllQuery())
                     .addSort(SortBuilders.fieldSort("kkk"))
                     .execute().actionGet();
-            assert false;
+                assertThat("Expected exception but returned with", result, nullValue());
         } catch (SearchPhaseExecutionException e) {
 
         }
@@ -823,8 +823,7 @@ public class SimpleSortTests extends AbstractSharedClusterTest {
                 .setQuery(matchAllQuery())
                 .addSort(SortBuilders.fieldSort("kkk").ignoreUnmapped(true))
                 .execute().actionGet();
-
-        assertThat(searchResponse.getFailedShards(), equalTo(0));
+        assertNoFailures(searchResponse);
     }
 
     @Test