### Question:
MongoCommander { public static String ensureIndexes(String indexFile, String db, MongoTemplate mongoTemplate) { Set<MongoIndex> indexes = indexTxtFileParser.parse(indexFile); DB dbConn = getDB(db, mongoTemplate); return ensureIndexes(indexes, dbConn); } private  MongoCommander(); static String ensureIndexes(String indexFile, String db, MongoTemplate mongoTemplate); static String ensureIndexes(Set<String> indexes, String db, MongoTemplate mongoTemplate); static String ensureIndexes(Set<MongoIndex> indexes, DB dbConn); @SuppressWarnings("boxing") static String ensureIndexes(MongoIndex index, DB dbConn, int indexOrder); static String preSplit(Set<String> shardCollections, String dbName, MongoTemplate mongoTemplate); static DB getDB(String db, MongoTemplate mongoTemplate); static DB getDB(String db, DB dbConn); static final String STR_0X38; }### Answer:
@Test public void testEnsureIndexes() { String result = MongoCommander.ensureIndexes("mongoTestIndexes.txt", dbName, mockedMongoTemplate); assertNull(result); for (String collection : shardCollections) { DBObject asskeys = new BasicDBObject(); asskeys.put("creationTime", 1); DBObject options = buildOpts(dbName + "." + collection, collectionOrder.get(collection)); Mockito.verify(collectionIns.get(collection), Mockito.times(1)).createIndex(asskeys, options); } }
@Test public void testEnsureSetIndexes() { String result = MongoCommander.ensureIndexes(indexes, dbName, mockedMongoTemplate); assertNull(result); for (String collection : shardCollections) { DBObject asskeys = new BasicDBObject(); asskeys.put("creationTime", 1); DBObject options = buildOpts(dbName + "." + collection, collectionOrder.get(collection)); Mockito.verify(collectionIns.get(collection), Mockito.times(1)).createIndex(asskeys, options); } }