From 0bc5b35a5948596858c317f401ea166b3e66ff42 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 20 May 2015 13:00:26 +0200 Subject: [PATCH] [TEST] Add better assertion messages --- .../test/ElasticsearchIntegrationTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index 608d90f148b..a4a2034d8e3 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -1177,17 +1177,17 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState); // remove local node reference localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null); - Map localStateMap = convertToMap(localClusterState); - int localClusterStateSize = localClusterState.toString().length(); + final Map localStateMap = convertToMap(localClusterState); + final int localClusterStateSize = localClusterState.toString().length(); // Check that the non-master node has the same version of the cluster state as the master and that this node didn't disconnect from the master if (masterClusterState.version() == localClusterState.version() && localClusterState.nodes().nodes().containsKey(masterId)) { try { - assertThat(masterClusterState.uuid(), equalTo(localClusterState.uuid())); + assertEquals("clusterstate UUID does not match", masterClusterState.uuid(), localClusterState.uuid()); // We cannot compare serialization bytes since serialization order of maps is not guaranteed // but we can compare serialization sizes - they should be the same - assertThat(masterClusterStateSize, equalTo(localClusterStateSize)); + assertEquals("clusterstate size does not match", masterClusterStateSize, localClusterStateSize); // Compare JSON serialization - assertThat(mapsEqualIgnoringArrayOrder(masterStateMap, localStateMap), equalTo(true)); + assertTrue("clusterstate JSON serialization does not match", mapsEqualIgnoringArrayOrder(masterStateMap, localStateMap)); } catch (AssertionError error) { logger.error("Cluster state from master:\n{}\nLocal cluster state:\n{}", masterClusterState.toString(), localClusterState.toString()); throw error;