### Question:
MongoDatabaseHandler extends SimpleChannelInboundHandler<ClientRequest> { CompletionStage<MongoMessage> handleMessageAsync(MongoMessage message) { return mongoBackend.handleMessageAsync(message) .handle((document, ex) -> createResponseMongoMessage(message, document, ex)); } MongoDatabaseHandler(MongoBackend mongoBackend, ChannelGroup channelGroup); @Override void channelActive(ChannelHandlerContext ctx); @Override void channelInactive(ChannelHandlerContext ctx);  }### Answer:
@Test void testHandleMessageUnknownError() throws Exception { final MongoBackend backend = mock(MongoBackend.class); when(backend.handleMessageAsync(any())).thenCallRealMethod(); when(backend.handleMessage(any())).thenThrow(new RuntimeException("unexpected")); final Channel channel = mock(Channel.class); final MessageHeader header = new MessageHeader(0, 0); final MongoDatabaseHandler handler = new MongoDatabaseHandler(backend, null); MongoMessage requestMessage = new MongoMessage(channel, header, new Document("key", "1")); MongoMessage responseMessage = handler.handleMessageAsync(requestMessage).toCompletableFuture().get(); assertThat(responseMessage).isNotNull(); Document responseMessageDoc = responseMessage.getDocument(); assertThat(responseMessageDoc).isNotNull(); assertThat(responseMessageDoc.get("$err")).isEqualTo("Unknown error: unexpected"); assertThat(responseMessageDoc.get("errmsg")).isEqualTo("Unknown error: unexpected"); assertThat(responseMessageDoc.get("ok")).isEqualTo(0); }