@Test
public void shardCollectionHashedTest() throws ExecutionException, UnsupportedException {

    //
    TableMetadataBuilder tableMetadataBuilder = new TableMetadataBuilder(DB_NAME, COLLECTION_NAME, CLUSTER_NAME);
    Mockito.when(client.getDB("admin")).thenReturn(database);
    CommandResult commandRes = Mockito.mock(CommandResult.class);
    Mockito.when(commandRes.ok()).thenReturn(true);
    Mockito.when(database.command(Matchers.any(BasicDBObject.class))).thenReturn(commandRes);
    PowerMockito.mockStatic(SelectorOptionsUtils.class);
    Map<String, Selector> options = new HashMap<>();
    options.put(TableOptions.SHARD_KEY_TYPE.getOptionName(), new StringSelector(ShardKeyType.HASHED.getKeyType()));
    options.put(TableOptions.SHARD_KEY_FIELDS.getOptionName(), new StringSelector(COLUMN_NAME));
    Mockito.when(SelectorOptionsUtils.processOptions(Matchers.anyMap())).thenReturn(options);
    ShardUtils.shardCollection(client, tableMetadataBuilder.build());
    Mockito.verify(database, Mockito.times(1)).command(new BasicDBObject("enableSharding", DB_NAME));
    BasicDBObject commandExpected = new BasicDBObject("shardCollection", DB_NAME + "." + COLLECTION_NAME);
    commandExpected.put("key", new BasicDBObject(COLUMN_NAME, "hashed"));
    Mockito.verify(database, Mockito.times(1)).command(commandExpected);
}