Skip to content

Commit

Permalink
Merge pull request #57 from salesforce/fix-icu-date-parse
Browse files Browse the repository at this point in the history
fix unstable test
  • Loading branch information
yoikawa authored May 22, 2024
2 parents 217138b + 1a26c74 commit 62fd0be
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ public void testCacheConfig() throws InterruptedException {

GrammaticalLabelSetLoader loader = new GrammaticalLabelSetLoader(config);
loader.getSet(ENGLISH);

Thread.sleep(1);
assertNull(loader.getCache().getIfPresent(desc));

Expand All @@ -569,21 +568,25 @@ public void testCacheConfig() throws InterruptedException {
assertEquals(0, loader.getCache().size());

loader.getSet(ENGLISH);
Thread.sleep(1);
assertEquals(1, loader.getCache().size());

loader.getSet(ENGLISH_AU);
Thread.sleep(1);
assertEquals(3, loader.getCache().size());
assertNotNull(loader.getCache().getIfPresent(desc));
assertNotNull(loader.getCache().getIfPresent(desc.getForOtherLanguage(ENGLISH_GB)));
assertNotNull(loader.getCache().getIfPresent(desc.getForOtherLanguage(ENGLISH_AU)));

// Caffeine does not evict prior the threadshold, but after the size crossed
loader.getSet(FRENCH);
assertEquals(4, loader.getCache().size());
Thread.sleep(1);
assertEquals(3, loader.getCache().size());
assertNotNull(loader.getCache().getIfPresent(desc.getForOtherLanguage(FRENCH)));

loader.getSet(GERMAN);
assertEquals(4, loader.getCache().size());
Thread.sleep(1);
assertEquals(3, loader.getCache().size());
assertNotNull(loader.getCache().getIfPresent(desc.getForOtherLanguage(GERMAN)));
}
}

0 comments on commit 62fd0be

Please sign in to comment.