Skip to content

Commit

Permalink
update(test): test noCache param
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Sep 29, 2024
1 parent b1f1b80 commit 4ab1f23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.muedsa.snapshot.tools

import org.junit.jupiter.api.assertThrows
import kotlin.test.Test
import kotlin.test.assertEquals

class SimpleLimitedNetworkImageCacheTest {

Expand Down Expand Up @@ -36,10 +37,11 @@ class SimpleLimitedNetworkImageCacheTest {

@Test
fun no_cache_test() {
val cache = SimpleLimitedNetworkImageCache(maxSingleImageSize = 1, maxImageNum = 1, debug = true)
val cache = SimpleLimitedNetworkImageCache(maxSingleImageSize = 1024 * 1024 * 5, maxImageNum = 2, debug = true)
cache.getImage(SimpleNoLimitedNetworkImageCacheTest.TEST_IMAGE_URL_1, true)
cache.getImage(SimpleNoLimitedNetworkImageCacheTest.TEST_IMAGE_URL_2, true)
cache.getImage(SimpleNoLimitedNetworkImageCacheTest.TEST_IMAGE_URL_3, true)
cache.getImage(SimpleNoLimitedNetworkImageCacheTest.TEST_IMAGE_URL_4, true)
assertEquals(cache.count(), 0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.muedsa.snapshot.tools
import org.junit.jupiter.api.assertThrows
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.expect

class SimpleNoLimitedNetworkImageCacheTest {
Expand Down Expand Up @@ -77,8 +78,12 @@ class SimpleNoLimitedNetworkImageCacheTest {
@Test
fun no_cache_test() {
SimpleNoLimitedNetworkImageCache.getImage(TEST_IMAGE_URL_1, true)
SimpleNoLimitedNetworkImageCache.getImage(TEST_IMAGE_URL_1, true)
SimpleNoLimitedNetworkImageCache.getImage(TEST_IMAGE_URL_2, true)
SimpleNoLimitedNetworkImageCache.getImage(TEST_IMAGE_URL_2, true)
SimpleNoLimitedNetworkImageCache.getImage(TEST_IMAGE_URL_3, true)
SimpleNoLimitedNetworkImageCache.getImage(TEST_IMAGE_URL_3, true)
assertEquals(SimpleNoLimitedNetworkImageCache.count(), 0)
}

companion object {
Expand Down

0 comments on commit 4ab1f23

Please sign in to comment.