use of org.opensearch.search.SearchException in project OpenSearch by opensearch-project.
the class ExceptionSerializationTests method testSearchException.
public void testSearchException() throws IOException {
SearchShardTarget target = new SearchShardTarget("foo", new ShardId("bar", "_na_", 1), null, OriginalIndices.NONE);
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