@Test
public void newInstanceWithCustomKeys() {

    final IndexKey key1 = DefaultIndexKey.of(FIELD_1_NAME, IndexDirection.ASCENDING);
    final IndexKey key2 = DefaultIndexKey.of(FIELD_2_NAME, IndexDirection.DESCENDING);
    final List<IndexKey> keys = Arrays.asList(key1, key2);
    final Index actual = IndexFactory.newInstanceWithCustomKeys(INDEX_NAME, keys, UNIQUE);
    final BsonDocument expectedKeys = new BsonDocument();
    expectedKeys.put(FIELD_1_NAME, IndexDirection.ASCENDING.getBsonInt());
    expectedKeys.put(FIELD_2_NAME, IndexDirection.DESCENDING.getBsonInt());
    final Index expected = Index.of(expectedKeys, INDEX_NAME, UNIQUE, UNIQUE, BACKGROUND);
    assertThat(actual).isEqualTo(expected);
}