### Question:
MessageWriter { Future<Boolean> writeCheckpointMessageWithError(String sequenceNumber, Long subSequenceNumber, Throwable throwable) { return writeMessage(new CheckpointMessage(sequenceNumber, subSequenceNumber, throwable)); } MessageWriter();   }### Answer:
@Test public void writeCheckpointMessageNoErrorTest() throws IOException, InterruptedException, ExecutionException { Future<Boolean> future = this.messageWriter.writeCheckpointMessageWithError("1234", 0L, null); future.get(); verify(this.stream, Mockito.atLeastOnce()).write(Mockito.any(byte[].class), Mockito.anyInt(), Mockito.anyInt()); verify(this.stream, Mockito.atLeastOnce()).flush(); }
@Test public void writeCheckpointMessageWithErrorTest() throws IOException, InterruptedException, ExecutionException { Future<Boolean> future = this.messageWriter.writeCheckpointMessageWithError("1234", 0L, new Throwable()); future.get(); verify(this.stream, Mockito.atLeastOnce()).write(Mockito.any(byte[].class), Mockito.anyInt(), Mockito.anyInt()); verify(this.stream, Mockito.atLeastOnce()).flush(); }