From f4fa720b8af8cb603e8b387b105158e884808b88 Mon Sep 17 00:00:00 2001 From: nikunjagarwal321 Date: Sat, 9 Nov 2024 14:57:46 -0600 Subject: [PATCH] Fixed flaky test shouldGetClsAsRootEntity in SubjectClosureResolver_TestCase by make it deterministic and free from order --- .../webprotege/entity/SubjectClosureResolver_TestCase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/edu/stanford/protege/webprotege/entity/SubjectClosureResolver_TestCase.java b/src/test/java/edu/stanford/protege/webprotege/entity/SubjectClosureResolver_TestCase.java index 81850922b..97776f825 100644 --- a/src/test/java/edu/stanford/protege/webprotege/entity/SubjectClosureResolver_TestCase.java +++ b/src/test/java/edu/stanford/protege/webprotege/entity/SubjectClosureResolver_TestCase.java @@ -19,6 +19,7 @@ import static java.util.stream.Collectors.toSet; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.hasItems; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -68,7 +69,7 @@ public void shouldGetClsAsRootEntity() { when(axiom.getSubject()).thenReturn(clsIri); var rootEntities = resolver.resolve(valueEntity) .collect(toSet()); - assertThat(rootEntities, contains(cls, valueEntity)); + assertThat(rootEntities, hasItems(cls, valueEntity)); } @Test