diff options
author | Allan Wang <me@allanwang.ca> | 2018-01-18 23:23:56 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2018-01-20 16:42:37 -0500 |
commit | d766100c297bc094491de150f24c04719ffa8f4e (patch) | |
tree | b69863dace2fcb45d5fd25c276ca450e07305c44 /app/src/test/kotlin/com/pitchedapps/frost/rx/ResettableFlyweightTest.kt | |
parent | 78b3cc41e4c9f8d141ad46ee75e476fa2d177f19 (diff) | |
download | frost-d766100c297bc094491de150f24c04719ffa8f4e.tar.gz frost-d766100c297bc094491de150f24c04719ffa8f4e.tar.bz2 frost-d766100c297bc094491de150f24c04719ffa8f4e.zip |
Enhancement/speed up (#650)
* Revert back to m.facebook
* Add initial speedup
* Update theme
* Fix link press for event status
* Move web states to fb const
* Fix images and email
* Fix up flyweight for requests
* Ensure frost request is synchronous
* Prepare diff utils
* Improve speed and fix blank overlay
* Update comments
* Add debugger and fix searchview
* Theme discover pages. Resolves #654
* Fix duplicate reload
* Fix image loading
* Update changelog
* Update tests
* Rename test
Update dependencies
Update gitignore
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost/rx/ResettableFlyweightTest.kt')
-rw-r--r-- | app/src/test/kotlin/com/pitchedapps/frost/rx/ResettableFlyweightTest.kt | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/rx/ResettableFlyweightTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/rx/ResettableFlyweightTest.kt index ec92b059..a520e9e3 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/rx/ResettableFlyweightTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/rx/ResettableFlyweightTest.kt @@ -1,10 +1,8 @@ package com.pitchedapps.frost.rx +import com.pitchedapps.frost.internal.concurrentTest import org.junit.Before import org.junit.Test -import java.util.concurrent.CountDownLatch -import kotlin.test.assertEquals -import kotlin.test.assertNotEquals /** * Created by Allan Wang on 07/01/18. @@ -27,34 +25,34 @@ class ResettableFlyweightTest { } private lateinit var flyweight: IntFlyweight - private lateinit var latch: CountDownLatch @Before fun init() { flyweight = IntFlyweight() - latch = CountDownLatch(1) } @Test - fun testCache() { - flyweight(1).subscribe { i -> - flyweight(1).subscribe { j -> - assertEquals(i, j, "Did not use cache during calls") - latch.countDown() + fun testCache() = concurrentTest { result -> + flyweight(1).subscribe { i, _ -> + flyweight(1).subscribe { j, _ -> + if (i != null && i == j) + result.onComplete() + else + result.onError("Did not use cache during calls") } } - latch.await() } @Test - fun testNoCache() { - flyweight(1).subscribe { i -> - flyweight(2).subscribe { j -> - assertNotEquals(i, j, "Should not use cache for calls with different keys") - latch.countDown() + fun testNoCache() = concurrentTest { result -> + flyweight(1).subscribe { i, _ -> + flyweight(2).subscribe { j, _ -> + if (i != null && i != j) + result.onComplete() + else + result.onError("Should not use cache for calls with different keys") } } - latch.await() } |