### Question:
AbstractMongoBackend implements MongoBackend { @Override public Document handleCommand(Channel channel, String databaseName, String command, Document query) { Document commandSync = handleCommandSync(channel, databaseName, command, query); if (commandSync != null) { return commandSync; } if (databaseName.equals(ADMIN_DB_NAME)) { return handleAdminCommand(command, query); } return resolveDatabase(databaseName).handleCommand(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 testHandleCommand() { Channel channel = Mockito.mock(Channel.class); when(channel.remoteAddress()).thenReturn(new InetSocketAddress("127.0.1.254", 27017)); Document response = backend.handleCommand(channel, null, "whatsmyuri", null); assertThat(response).isNotNull(); assertThat(response.get("ok")).isEqualTo(1.0); assertThat(response.get("you")).isEqualTo("127.0.1.254:27017"); }
@Test void testMongoDatabaseHandleCommand() { Channel channel = Mockito.mock(Channel.class); Document response = backend.handleCommand(channel, "mockDatabase", "find", null); assertThat(response).isNotNull(); assertThat(response.get("ok")).isEqualTo(1.0); assertThat(response.get("message")).isEqualTo("fakeResponse"); }