YARN-2158. Improved assertion messages of TestRMWebServicesAppsModification. Contributed by Varun Vasudev.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1608667 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhijie Shen 2014-07-08 05:50:04 +00:00
parent 76a621ffd2
commit 12c4197b35
2 changed files with 9 additions and 3 deletions

View File

@ -355,6 +355,9 @@ Release 2.5.0 - UNRELEASED
YARN-2250. FairScheduler.findLowestCommonAncestorQueue returns null when YARN-2250. FairScheduler.findLowestCommonAncestorQueue returns null when
queues not identical (Krisztian Horvath via Sandy Ryza) queues not identical (Krisztian Horvath via Sandy Ryza)
YARN-2158. Improved assertion messages of TestRMWebServicesAppsModification.
(Varun Vasudev via zjshen)
Release 2.4.1 - 2014-06-23 Release 2.4.1 - 2014-06-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -411,13 +411,15 @@ protected static void verifyAppStateJson(ClientResponse response,
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
JSONObject json = response.getEntity(JSONObject.class); JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length()); assertEquals("incorrect number of elements", 1, json.length());
String responseState = json.getString("state");
boolean valid = false; boolean valid = false;
for (RMAppState state : states) { for (RMAppState state : states) {
if (state.toString().equals(json.getString("state"))) { if (state.toString().equals(responseState)) {
valid = true; valid = true;
} }
} }
assertTrue("app state incorrect", valid); String msg = "app state incorrect, got " + responseState;
assertTrue(msg, valid);
return; return;
} }
@ -441,7 +443,8 @@ protected static void verifyAppStateXML(ClientResponse response,
valid = true; valid = true;
} }
} }
assertTrue("app state incorrect", valid); String msg = "app state incorrect, got " + state;
assertTrue(msg, valid);
return; return;
} }