public void testBatchOperationException() throws IOException { ShardId id = new ShardId("foo", 1); TranslogRecoveryPerformer.BatchOperationException ex = serialize( new TranslogRecoveryPerformer.BatchOperationException( id, "batched the f****r", 666, null)); assertEquals(ex.shardId(), id); assertEquals(666, ex.completedOperations()); assertEquals("batched the f****r", ex.getMessage()); assertNull(ex.getCause()); ex = serialize( new TranslogRecoveryPerformer.BatchOperationException( null, "batched the f****r", -1, new NullPointerException())); assertNull(ex.shardId()); assertEquals(-1, ex.completedOperations()); assertEquals("batched the f****r", ex.getMessage()); assertTrue(ex.getCause() instanceof NullPointerException); }