### Question:
AsyncRpcSender implements RpcSender { @Override public void send(Message message) { this.executorService.submit(() -> sendMessage(message)); } AsyncRpcSender(ExecutorService executorService, ObjectMapper msgPacker); @Override void send(Message message); @Override void attach(OutputStream outputStream); @Override void stop();  }### Answer:
@Test(expected = IllegalStateException.class) public void cantSendWithoutAttaching() { prepareSequentialExecutorService(); asyncRpcSender.send(() -> MessageType.REQUEST); }
@Test public void testSend() throws IOException { asyncRpcSender.attach(outputStream); prepareSequentialExecutorService(); Message message = () -> MessageType.REQUEST; given(objectMapper.writer()).willReturn(objectWriter); doNothing().when(objectWriter).writeValue(outputStream, message); asyncRpcSender.send(message); verify(objectMapper).writer(); verify(objectWriter).writeValue(outputStream, message); }