diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/MaxSizeSessionCacheDecoratorTest.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/MaxSizeSessionCacheDecoratorTest.java index 0f04d4d69..646e6bf79 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/MaxSizeSessionCacheDecoratorTest.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/MaxSizeSessionCacheDecoratorTest.java @@ -40,15 +40,18 @@ public class MaxSizeSessionCacheDecoratorTest { Assertions.assertEquals(3, maxSizeSessionCacheDecorator.getSessionIds().size()); - List newEngines = getMockedEngines(2); + LinkedHashMap newEngines = addMockedEngines(maxSizeSessionCacheDecorator, 2); - for (ValidationEngine engine : newEngines) { - maxSizeSessionCacheDecorator.cacheSession(engine); - } Assertions.assertEquals(4, maxSizeSessionCacheDecorator.getSessionIds().size()); + Assertions.assertTrue(maxSizeSessionCacheDecorator.getSessionIds().contains(getKeyByIndex(initialEngines, 1))); + Assertions.assertTrue(maxSizeSessionCacheDecorator.getSessionIds().contains(getKeyByIndex(initialEngines, 2))); + Assertions.assertTrue(maxSizeSessionCacheDecorator.getSessionIds().contains(getKeyByIndex(newEngines, 0))); + Assertions.assertTrue(maxSizeSessionCacheDecorator.getSessionIds().contains(getKeyByIndex(newEngines, 1))); - Assertions.assertTrue(maxSizeSessionCacheDecorator.getSessionIds().contains() } + private String getKeyByIndex(LinkedHashMap engineMap, int index) { + return (String) engineMap.keySet().toArray()[index]; + } }