Browse Source

Tests: Only check that the cache size can shrink

pull/270/head
weisj 3 years ago
parent
commit
d90247ca5b
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 3
      core/src/test/java/com/github/weisj/darklaf/core/test/IconCacheTest.java
  2. 3
      utils/src/test/java/com/github/weisj/darklaf/util/cache/SoftCacheTest.java

3
core/src/test/java/com/github/weisj/darklaf/core/test/IconCacheTest.java

@ -40,8 +40,9 @@ class IconCacheTest implements NonThreadSafeTest {
IconSet.ICON_LOADER.clearCache(); IconSet.ICON_LOADER.clearCache();
UIDefaults defaults = new DarkLaf().getDefaults(); UIDefaults defaults = new DarkLaf().getDefaults();
Assertions.assertFalse(IconSet.ICON_LOADER.isCacheEmpty()); Assertions.assertFalse(IconSet.ICON_LOADER.isCacheEmpty());
int size = IconSet.ICON_LOADER.cacheSize();
defaults.clear(); defaults.clear();
waitForGarbageCollection(() -> !IconSet.ICON_LOADER.isCacheEmpty()); waitForGarbageCollection(() -> IconSet.ICON_LOADER.cacheSize() == size);
} }
@SuppressWarnings({"unused"}) @SuppressWarnings({"unused"})

3
utils/src/test/java/com/github/weisj/darklaf/util/cache/SoftCacheTest.java vendored

@ -45,9 +45,10 @@ class SoftCacheTest {
Assertions.assertEquals(count, hardReferences.size()); Assertions.assertEquals(count, hardReferences.size());
Assertions.assertEquals(count, cache.size()); Assertions.assertEquals(count, cache.size());
int cacheSize = cache.size();
hardReferences.clear(); hardReferences.clear();
waitForGarbageCollection(() -> !cache.isEmpty()); waitForGarbageCollection(() -> cache.size() == cacheSize);
} }
@SuppressWarnings({"unused"}) @SuppressWarnings({"unused"})

Loading…
Cancel
Save