From 1554fb375786eeaf615717af15a27523b835051f Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 1 May 2019 15:55:55 -0700 Subject: Restrict coroutine test --- .../test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'app/src/test/kotlin/com/pitchedapps/frost') diff --git a/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt index e93f507c..5cde7323 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt @@ -246,6 +246,8 @@ class CoroutineTest { } } + class TestException(msg: String) : RuntimeException(msg) + @Test fun exceptionChecks() { val mainTag = "main-test" @@ -257,7 +259,7 @@ class CoroutineTest { val job = SupervisorJob() val flyweight = Flyweight(GlobalScope, 200L) { - throw java.lang.RuntimeException("Flyweight exception") + throw TestException("Flyweight exception") } suspend fun crash(): Boolean = withContext(Dispatchers.IO) { @@ -266,7 +268,7 @@ class CoroutineTest { flyweight.fetch(0).await() } true - } catch (e: java.lang.Exception) { + } catch (e: TestException) { false } } @@ -282,10 +284,6 @@ class CoroutineTest { println("B") channel.offer(1) } -// launch { -// delay(2000) -// job.cancel() -// } } } } -- cgit v1.2.3