mirror of https://github.com/apache/lucene.git
LUCENE-9905: Fix check in TestPerFieldKnnVectorsFormat#testMergeUsesNewFormat
Before the assertion checked if two sets were equal, which resulted in rare failures. Now we use 'contains' from hamcrest matchers.
This commit is contained in:
parent
18f9d31608
commit
a4b30b4cf4
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.lucene.codecs.perfield;
|
package org.apache.lucene.codecs.perfield;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.contains;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -154,8 +155,8 @@ public class TestPerFieldKnnVectorsFormat extends BaseKnnVectorsFormatTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the new format was used while merging
|
// Check that the new format was used while merging
|
||||||
MatcherAssert.assertThat(format1.fieldsWritten, equalTo(Set.of("field1")));
|
MatcherAssert.assertThat(format1.fieldsWritten, contains("field1"));
|
||||||
MatcherAssert.assertThat(format2.fieldsWritten, equalTo(Set.of("field2")));
|
MatcherAssert.assertThat(format2.fieldsWritten, contains("field2"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue