### Question:
AbstractMongoBackend implements MongoBackend { private Document handleAdminCommand(String command, Document query) { if (command.equalsIgnoreCase("listdatabases")) { List<Document> databases = listDatabaseNames().stream() .sorted() .map(databaseName -> { MongoDatabase database = openOrCreateDatabase(databaseName); Document dbObj = new Document("name", database.getDatabaseName()); dbObj.put("empty", Boolean.valueOf(database.isEmpty())); return dbObj; }) .collect(Collectors.toList()); Document response = new Document(); response.put("databases", databases); Utils.markOkay(response); return response; } else if (command.equalsIgnoreCase("find")) { String collectionName = (String) query.get(command); if (collectionName.equals("$cmd.sys.inprog")) { return Utils.firstBatchCursorResponse(collectionName, new Document("inprog", Collections.emptyList())); } else { throw new NoSuchCommandException(new Document(command, collectionName).toString()); } } else if (command.equalsIgnoreCase("replSetGetStatus")) { throw new NoReplicationEnabledException(); } else if (command.equalsIgnoreCase("getLog")) { final Object argument = query.get(command); return getLog(argument == null ? null : argument.toString()); } else if (command.equalsIgnoreCase("renameCollection")) { return handleRenameCollection(command, query); } else if (command.equalsIgnoreCase("getLastError")) { log.debug("getLastError on admin database"); return successResponse(); } else if (command.equalsIgnoreCase("connectionStatus")) { Document response = new Document(); response.append("authInfo", new Document() .append("authenticatedUsers", Collections.emptyList()) .append("authenticatedUserRoles", Collections.emptyList()) ); Utils.markOkay(response); return response; } else if (command.equalsIgnoreCase("hostInfo")) { return handleHostInfo(); } else if (command.equalsIgnoreCase("getCmdLineOpts")) { return handleGetCmdLineOpts(); } else if (command.equalsIgnoreCase("getFreeMonitoringStatus")) { return handleGetFreeMonitoringStatus(); } else if (command.equalsIgnoreCase("serverStatus")) { return getServerStatus(); } else if (command.equalsIgnoreCase("ping")) { return successResponse(); } else if (command.equalsIgnoreCase("endSessions")) { log.debug("endSessions on admin database"); return successResponse(); } else { throw new NoSuchCommandException(command); } } 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 testHandleAdminCommand() { Channel channel = Mockito.mock(Channel.class); Document response = backend.handleCommand(channel, ADMIN_DB_NAME, "ping", null); assertThat(response).isNotNull(); assertThat(response.get("ok")).isEqualTo(1.0); }