use of org.elasticsearch.indices.recovery.RecoverFilesRecoveryException in project elasticsearch by elastic.
the class ExceptionSerializationTests method testRecoverFilesRecoveryException.
public void testRecoverFilesRecoveryException() throws IOException {
ShardId id = new ShardId("foo", "_na_", 1);
ByteSizeValue bytes = new ByteSizeValue(randomIntBetween(0, 10000));
RecoverFilesRecoveryException ex = serialize(new RecoverFilesRecoveryException(id, 10, bytes, null));
assertEquals(ex.getShardId(), id);
assertEquals(ex.numberOfFiles(), 10);
assertEquals(ex.totalFilesSize(), bytes);
assertEquals(ex.getMessage(), "Failed to transfer [10] files with total size of [" + bytes + "]");
assertNull(ex.getCause());
ex = serialize(new RecoverFilesRecoveryException(null, 10, bytes, new NullPointerException()));
assertNull(ex.getShardId());
assertEquals(ex.numberOfFiles(), 10);
assertEquals(ex.totalFilesSize(), bytes);
assertEquals(ex.getMessage(), "Failed to transfer [10] files with total size of [" + bytes + "]");
assertTrue(ex.getCause() instanceof NullPointerException);
}
Aggregations