Search in sources :

Example 1 with IllegalShardRoutingStateException

use of org.elasticsearch.cluster.routing.IllegalShardRoutingStateException in project elasticsearch by elastic.

the class ExceptionSerializationTests method testIllegalShardRoutingStateException.

public void testIllegalShardRoutingStateException() throws IOException {
    final ShardRouting routing = TestShardRouting.newShardRouting("test", 0, "xyz", "def", false, ShardRoutingState.STARTED);
    final String routingAsString = routing.toString();
    IllegalShardRoutingStateException serialize = serialize(new IllegalShardRoutingStateException(routing, "foo", new NullPointerException()));
    assertNotNull(serialize.shard());
    assertEquals(routing, serialize.shard());
    assertEquals(routingAsString + ": foo", serialize.getMessage());
    assertTrue(serialize.getCause() instanceof NullPointerException);
    serialize = serialize(new IllegalShardRoutingStateException(routing, "bar", null));
    assertNotNull(serialize.shard());
    assertEquals(routing, serialize.shard());
    assertEquals(routingAsString + ": bar", serialize.getMessage());
    assertNull(serialize.getCause());
}
Also used : IllegalShardRoutingStateException(org.elasticsearch.cluster.routing.IllegalShardRoutingStateException) TestShardRouting(org.elasticsearch.cluster.routing.TestShardRouting) ShardRouting(org.elasticsearch.cluster.routing.ShardRouting)

Aggregations

IllegalShardRoutingStateException (org.elasticsearch.cluster.routing.IllegalShardRoutingStateException)1 ShardRouting (org.elasticsearch.cluster.routing.ShardRouting)1 TestShardRouting (org.elasticsearch.cluster.routing.TestShardRouting)1