Skip to content

Commit

Permalink
Fix test on MaxSize
Browse files Browse the repository at this point in the history
  • Loading branch information
dotasek committed Jun 18, 2024
1 parent 4fa581d commit 3a7507c
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ public void trivialCase() {

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];
}
}

0 comments on commit 3a7507c

Please sign in to comment.