use of org.elasticsearch.search.SearchException in project elasticsearch by elastic.
the class ExceptionSerializationTests method testSearchException.
public void testSearchException() throws IOException {
SearchShardTarget target = new SearchShardTarget("foo", new Index("bar", "_na_"), 1);
SearchException ex = serialize(new SearchException(target, "hello world"));
assertEquals(target, ex.shard());
assertEquals(ex.getMessage(), "hello world");
ex = serialize(new SearchException(null, "hello world", new NullPointerException()));
assertNull(ex.shard());
assertEquals(ex.getMessage(), "hello world");
assertTrue(ex.getCause() instanceof NullPointerException);
}
Aggregations