### Question:
AbstractMongoBackend implements MongoBackend { @Override public CompletionStage<Document> handleCommandAsync(Channel channel, String database, String command, Document query) { if ("dropDatabase".equalsIgnoreCase(command)) { return dropDatabaseAsync(database) .handle((aVoid, ex) -> { Document response = new Document("dropped", database); if (ex != null) { response.put("errmsg", ex.getMessage()); response.put("ok", 0.0); log.error("dropDatabase " + database + " error!", ex); } else { Utils.markOkay(response); } return response; }); } Document commandSync = handleCommandSync(channel, database, command, query); if (commandSync != null) { return FutureUtils.wrap(() -> commandSync); } if (database.equals(ADMIN_DB_NAME)) { return FutureUtils.wrap(() -> handleAdminCommand(command, query)); } return resolveDatabase(database).handleCommandAsync(channel, command, query, oplog); } protected  AbstractMongoBackend(); protected  AbstractMongoBackend(Clock clock); @Override MongoDatabase resolveDatabase(String databaseName); @Override Document getServerStatus(); @Override Document handleCommand(Channel channel, String databaseName, String command, Document query); @Override CompletionStage<Document> handleCommandAsync(Channel channel, String database,
                                                        String command, Document query); @Override Collection<Document> getCurrentOperations(MongoQuery query); @Override QueryResult handleQuery(MongoQuery query); @Override CompletionStage<QueryResult> handleQueryAsync(MongoQuery query); @Override QueryResult handleGetMore(long cursorId, int numberToReturn); @Override QueryResult handleGetMore(MongoGetMore getMore); @Override void handleInsert(MongoInsert insert); @Override CompletionStage<Void> handleInsertAsync(MongoInsert insert); @Override void handleDelete(MongoDelete delete); @Override CompletionStage<Void> handleDeleteAsync(MongoDelete delete); @Override void handleUpdate(MongoUpdate update); @Override CompletionStage<Void> handleUpdateAsync(MongoUpdate update); @Override void handleKillCursors(MongoKillCursors killCursors); @Override Document handleMessage(MongoMessage message); @Override void dropDatabase(String databaseName); @Override void handleClose(Channel channel); @Override void close(); @Override MongoBackend version(ServerVersion version); @Override Clock getClock(); @Override void disableOplog(); @Override void enableOplog();  }### Answer:
@Test void testHandleCommandAsyncDropDatabase() throws Exception { Channel channel = Mockito.mock(Channel.class); CompletionStage<Document> responseFuture = backend.handleCommandAsync(channel, "mockDatabase", "dropDatabase", null); Document response = responseFuture.toCompletableFuture().get(); assertThat(response).isNotNull(); assertThat(response.get("ok")).isEqualTo(1.0); assertThat(response.get("dropped")).isEqualTo("mockDatabase"); }
@Test void testHandleCommandAsyncDropDatabaseError() throws Exception { Channel channel = Mockito.mock(Channel.class); CompletionStage<Document> responseFuture = backendWithError.handleCommandAsync(channel, "mockDatabase", "dropDatabase", null); Document response = responseFuture.toCompletableFuture().get(); assertThat(response).isNotNull(); assertThat(response.get("ok")).isEqualTo(0.0); assertThat(response.get("dropped")).isEqualTo("mockDatabase"); assertThat(response.get("errmsg")).isEqualTo("unexpected"); }