Fix test on MaxSize

This commit is contained in:
dotasek 2024-06-18 16:05:50 -04:00
parent 4fa581d242
commit 3a7507c832
1 changed files with 8 additions and 5 deletions

View File

@ -40,15 +40,18 @@ public class MaxSizeSessionCacheDecoratorTest {
Assertions.assertEquals(3, maxSizeSessionCacheDecorator.getSessionIds().size());
List<ValidationEngine> newEngines = getMockedEngines(2);
LinkedHashMap<String, ValidationEngine> 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<String, ValidationEngine> engineMap, int index) {
return (String) engineMap.keySet().toArray()[index];
}
}