Merge branch 'master' into develop
diff --git a/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt b/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt
index 53b8fba..15f1976 100644
--- a/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt
@@ -58,7 +58,7 @@
             }
 
             override fun onCancellation(cause: Throwable?) {
-                assertTrue(cause is TestException0)
+                assertTrue(cause is TestException1)
                 expect(5)
             }
 
@@ -67,30 +67,27 @@
             }
 
             override fun onCompletedExceptionally(exception: Throwable) {
-                assertTrue(exception is TestException0)
+                assertTrue(exception is TestException1)
                 expect(9)
             }
         }
 
         coroutine.invokeOnCompletion(onCancelling = true) {
-            assertTrue(it is TestException0)
+            assertTrue(it is TestException1)
             expect(6)
         }
 
         coroutine.invokeOnCompletion {
-            assertTrue(it is TestException0)
+            assertTrue(it is TestException1)
             expect(8)
         }
 
         expect(2)
         coroutine.start()
         expect(4)
-        coroutine.cancel(TestException0())
+        coroutine.cancel(TestException1())
         expect(7)
-        coroutine.resumeWithException(TestException1())
+        coroutine.resumeWithException(TestException2())
         finish(10)
     }
-
-    private class TestException0 : Throwable()
-    private class TestException1 : Throwable()
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt b/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt
index e9d7e09..5b23b64 100644
--- a/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt
@@ -184,6 +184,4 @@
         assertEquals(d.await(), 42) // await shall throw CancellationException
         expectUnreached()
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/AsyncTest.kt b/common/kotlinx-coroutines-core-common/test/AsyncTest.kt
index 64ec1c2..ec9f6ec 100644
--- a/common/kotlinx-coroutines-core-common/test/AsyncTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AsyncTest.kt
@@ -238,6 +238,4 @@
             finish(3)
         }
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/AwaitTest.kt b/common/kotlinx-coroutines-core-common/test/AwaitTest.kt
index 6cd961d..b86c785 100644
--- a/common/kotlinx-coroutines-core-common/test/AwaitTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AwaitTest.kt
@@ -351,6 +351,4 @@
             async(NonCancellable) { throw TestException() }
         joinAll(job, job, job)
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt b/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt
index 7edf655..0a6e44e 100644
--- a/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt
@@ -116,6 +116,4 @@
         continuation!!.resume(Unit) // Should not fail
         finish(4)
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt b/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt
index 3209b7b..cbfc6df 100644
--- a/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt
@@ -184,6 +184,4 @@
             assertTrue(e is T)
         }
     }
-
-    class TestException : Throwable()
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt b/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt
index 253b9b5..95e9366 100644
--- a/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt
@@ -44,6 +44,4 @@
         assertTrue(parent.isCancelled)
         assertTrue(parent.getCompletionExceptionOrNull() is TestException)
     }
-
-    private class TestException: RuntimeException()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt b/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt
index a256b17..915a724 100644
--- a/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt
@@ -258,7 +258,4 @@
 
     private fun scopePlusContext(c1: CoroutineContext, c2: CoroutineContext) =
         (ContextScope(c1) + c2).coroutineContext
-
-    private class TestException1 : Exception()
-    private class TestException2 : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt b/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt
index 3ac6d7a..b2ca727 100644
--- a/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt
@@ -330,9 +330,4 @@
     }
 
     private fun throwTestException() { throw TestException() }
-
-    private class TestException : Exception {
-        constructor(message: String): super(message)
-        constructor(): super()
-    }
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt b/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt
index 57a5e46..e4d0fad 100644
--- a/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt
@@ -59,6 +59,4 @@
         assertTrue(!job.isActive)
         assertTrue(job.isCancelled)
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt b/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt
index 3e1a4e2..dfcb462 100644
--- a/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt
@@ -159,6 +159,4 @@
         assertTrue(job.isCompleted)
         assertTrue(job.isCancelled)
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/JobTest.kt b/common/kotlinx-coroutines-core-common/test/JobTest.kt
index 61c8850..be9760c 100644
--- a/common/kotlinx-coroutines-core-common/test/JobTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/JobTest.kt
@@ -94,14 +94,13 @@
         val job = Job()
         val n = 100 * stressTestMultiplier
         val fireCount = IntArray(n)
-        class TestException : Throwable()
         for (i in 0 until n) job.invokeOnCompletion {
             fireCount[i]++
             throw TestException()
         }
         assertTrue(job.isActive)
         for (i in 0 until n) assertEquals(0, fireCount[i])
-        val tryCancel = Try<Unit> { job.cancel() }
+        val tryCancel = Try { job.cancel() }
         assertTrue(!job.isActive)
         for (i in 0 until n) assertEquals(1, fireCount[i])
         assertTrue(tryCancel.exception is CompletionHandlerException)
@@ -206,6 +205,4 @@
         assertTrue(job.isCancelled)
         assertTrue(parent.isCancelled)
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt b/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt
index f8d96e1..25a6a47 100644
--- a/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt
@@ -123,6 +123,4 @@
             finish(7)
         }
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt b/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt
index fdf0ac7..1e688d4 100644
--- a/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt
@@ -152,6 +152,4 @@
         }
         finish(3)
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt b/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt
index 978112f..130623b 100644
--- a/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt
@@ -218,7 +218,4 @@
         yield() // to coroutineScope
         finish(7)
     }
-
-    private class TestException1 : Exception()
-    private class TestException2 : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/TestBase.common.kt b/common/kotlinx-coroutines-core-common/test/TestBase.common.kt
index 691f159..805094a 100644
--- a/common/kotlinx-coroutines-core-common/test/TestBase.common.kt
+++ b/common/kotlinx-coroutines-core-common/test/TestBase.common.kt
@@ -20,3 +20,9 @@
         block: suspend CoroutineScope.() -> Unit
     )
 }
+
+public class TestException(message: String? = null) : Throwable(message)
+public class TestException1(message: String? = null) : Throwable(message)
+public class TestException2(message: String? = null) : Throwable(message)
+public class TestException3(message: String? = null) : Throwable(message)
+public class TestRuntimeException(message: String? = null) : RuntimeException(message)
diff --git a/common/kotlinx-coroutines-core-common/test/UnconfinedTest.kt b/common/kotlinx-coroutines-core-common/test/UnconfinedTest.kt
index f37c356..4f9cc9b 100644
--- a/common/kotlinx-coroutines-core-common/test/UnconfinedTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/UnconfinedTest.kt
@@ -110,6 +110,4 @@
 
         finish(7)
     }
-
-    class TestException : Throwable()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/WithContextTest.kt b/common/kotlinx-coroutines-core-common/test/WithContextTest.kt
index 2a687b8..f3c0440 100644
--- a/common/kotlinx-coroutines-core-common/test/WithContextTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/WithContextTest.kt
@@ -309,6 +309,4 @@
             }
         }
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt b/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt
index 8b88d0a..5890b8c 100644
--- a/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt
@@ -210,8 +210,6 @@
         }
     }
 
-    private class TestException : Exception()
-
     @Test
     fun testNegativeTimeout() = runTest {
         expect(1)
diff --git a/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt b/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt
index a0706cb..3899278 100644
--- a/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt
@@ -167,8 +167,6 @@
         }
     }
 
-    private class TestException : Exception()
-
     @Test
     fun testNegativeTimeout() = runTest {
         expect(1)
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt
index 0e695d9..0b3a222 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt
@@ -206,6 +206,4 @@
         assertTrue(sub.isClosedForReceive)
         check(sub.receiveOrNull() == null)
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt
index bcb0b40..79f73ae 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt
@@ -144,6 +144,4 @@
         channel.cancel(TestException())
         channel.receiveOrNull()
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt b/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt
index be2fad3..a5e180a 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt
@@ -147,6 +147,4 @@
             assertEquals(iterations, expected)
         }
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt
index 8c1959f..61b5fc7 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt
@@ -83,6 +83,4 @@
         channel.cancel(TestException())
         channel.receiveOrNull()
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt
index 788449b..763ed9b 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt
@@ -40,6 +40,4 @@
         channel.cancel(TestException())
         channel.receiveOrNull()
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt
index 6265105..9e01e81 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt
@@ -112,6 +112,4 @@
             finish(4)
         }
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt
index 12c14c0..7d8b421 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt
@@ -282,6 +282,4 @@
         channel.cancel(TestException())
         channel.receiveOrNull()
     }
-
-    private class TestException : Exception()
 }
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt
index e8bccc4..d231135 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt
@@ -4,11 +4,12 @@
 
 package kotlinx.coroutines.selects
 
+import kotlinx.coroutines.*
 import kotlin.coroutines.*
 import kotlin.coroutines.intrinsics.*
 import kotlin.test.*
 
-class SelectBuilderImplTest {
+class SelectBuilderImplTest : TestBase() {
     @Test
     fun testIdempotentSelectResumeInline() {
         var resumed = false
@@ -113,6 +114,4 @@
         check(!c.trySelect("OTHER"))
         check(c.trySelect("SELECT"))
     }
-
-    class TestException : Throwable()
 }
\ No newline at end of file
diff --git a/core/kotlinx-coroutines-core/test/AwaitJvmTest.kt b/core/kotlinx-coroutines-core/test/AwaitJvmTest.kt
index a04c8c8..8f8ef09 100644
--- a/core/kotlinx-coroutines-core/test/AwaitJvmTest.kt
+++ b/core/kotlinx-coroutines-core/test/AwaitJvmTest.kt
@@ -24,6 +24,4 @@
         }
         finish(iterations + 1)
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/core/kotlinx-coroutines-core/test/AwaitStressTest.kt b/core/kotlinx-coroutines-core/test/AwaitStressTest.kt
index f86cdda..1e53c55 100644
--- a/core/kotlinx-coroutines-core/test/AwaitStressTest.kt
+++ b/core/kotlinx-coroutines-core/test/AwaitStressTest.kt
@@ -10,10 +10,6 @@
 
 class AwaitStressTest : TestBase() {
 
-    private class TestException : Exception() {
-        override fun fillInStackTrace(): Throwable = this
-    }
-
     private val iterations = 50_000 * stressTestMultiplier
     private val pool = newFixedThreadPoolContext(4, "AwaitStressTest")
 
diff --git a/core/kotlinx-coroutines-core/test/CoroutinesJvmTest.kt b/core/kotlinx-coroutines-core/test/CoroutinesJvmTest.kt
index 4b65441..e890ea2 100644
--- a/core/kotlinx-coroutines-core/test/CoroutinesJvmTest.kt
+++ b/core/kotlinx-coroutines-core/test/CoroutinesJvmTest.kt
@@ -36,6 +36,4 @@
     }
 
     private fun throwTestException(): Unit = throw TestException()
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/core/kotlinx-coroutines-core/test/JobActivationStressTest.kt b/core/kotlinx-coroutines-core/test/JobActivationStressTest.kt
index 3ea8faf..8341df9 100644
--- a/core/kotlinx-coroutines-core/test/JobActivationStressTest.kt
+++ b/core/kotlinx-coroutines-core/test/JobActivationStressTest.kt
@@ -68,6 +68,4 @@
             }
         }
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/core/kotlinx-coroutines-core/test/JobChildStressTest.kt b/core/kotlinx-coroutines-core/test/JobChildStressTest.kt
index e32b222..107cc52 100644
--- a/core/kotlinx-coroutines-core/test/JobChildStressTest.kt
+++ b/core/kotlinx-coroutines-core/test/JobChildStressTest.kt
@@ -57,6 +57,4 @@
             }
         }
     }
-
-    private class TestException : Exception()
 }
\ No newline at end of file
diff --git a/core/kotlinx-coroutines-core/test/JoinStressTest.kt b/core/kotlinx-coroutines-core/test/JoinStressTest.kt
index 11850f5..b3619aa 100644
--- a/core/kotlinx-coroutines-core/test/JoinStressTest.kt
+++ b/core/kotlinx-coroutines-core/test/JoinStressTest.kt
@@ -20,10 +20,6 @@
         pool.close()
     }
 
-    class TestException : Exception() {
-        override fun fillInStackTrace(): Throwable = this
-    }
-
     @Test
     fun testExceptionalJoinWithCancellation() = runBlocking {
         val results = IntArray(2)
diff --git a/core/kotlinx-coroutines-core/test/exceptions/CoroutineExceptionHandlerJvmTest.kt b/core/kotlinx-coroutines-core/test/exceptions/CoroutineExceptionHandlerJvmTest.kt
index c4edde9..cea9713 100644
--- a/core/kotlinx-coroutines-core/test/exceptions/CoroutineExceptionHandlerJvmTest.kt
+++ b/core/kotlinx-coroutines-core/test/exceptions/CoroutineExceptionHandlerJvmTest.kt
@@ -39,6 +39,4 @@
 
         finish(3)
     }
-
-    private class TestException : Throwable()
 }
diff --git a/core/kotlinx-coroutines-core/test/exceptions/JobExceptionsStressTest.kt b/core/kotlinx-coroutines-core/test/exceptions/JobExceptionsStressTest.kt
index 20ddb98..b85a6bf 100644
--- a/core/kotlinx-coroutines-core/test/exceptions/JobExceptionsStressTest.kt
+++ b/core/kotlinx-coroutines-core/test/exceptions/JobExceptionsStressTest.kt
@@ -64,8 +64,4 @@
             assertTrue(classes.isEmpty(), "Expected all exception to be present, but following exceptions are missing: $classes")
         }
     }
-
-    private class TestException1 : Exception()
-    private class TestException2 : Exception()
-    private class TestException3 : Exception()
 }
diff --git a/core/kotlinx-coroutines-core/test/exceptions/ProduceExceptionsTest.kt b/core/kotlinx-coroutines-core/test/exceptions/ProduceExceptionsTest.kt
index 17dbbd0..c074e87 100644
--- a/core/kotlinx-coroutines-core/test/exceptions/ProduceExceptionsTest.kt
+++ b/core/kotlinx-coroutines-core/test/exceptions/ProduceExceptionsTest.kt
@@ -165,7 +165,4 @@
             finish(4)
         }
     }
-
-    class TestException : Exception()
-    class TestException2 : Exception()
 }
diff --git a/integration/kotlinx-coroutines-guava/test/ListenableFutureExceptionsTest.kt b/integration/kotlinx-coroutines-guava/test/ListenableFutureExceptionsTest.kt
index cc9e72d..4d5cfa2 100644
--- a/integration/kotlinx-coroutines-guava/test/ListenableFutureExceptionsTest.kt
+++ b/integration/kotlinx-coroutines-guava/test/ListenableFutureExceptionsTest.kt
@@ -46,10 +46,8 @@
         testException(TestException(), { it is TestException }, { i -> i!! + 1 })
     }
 
-    class TestException : CompletionException("test2")
-
     private fun testException(
-        exception: Exception,
+        exception: Throwable,
         expected: ((Throwable) -> Boolean),
         transformer: ((Int?) -> Int?)? = null
     ) {
@@ -61,7 +59,7 @@
             future.setException(exception)
             try {
                 chained.await()
-            } catch (e: Exception) {
+            } catch (e: Throwable) {
                 assertTrue(expected(e))
             }
         }
@@ -76,7 +74,7 @@
 
             try {
                 chained.await()
-            } catch (e: Exception) {
+            } catch (e: Throwable) {
                 assertTrue(expected(e))
             }
         }
diff --git a/integration/kotlinx-coroutines-guava/test/ListenableFutureTest.kt b/integration/kotlinx-coroutines-guava/test/ListenableFutureTest.kt
index 971419e..719c102 100644
--- a/integration/kotlinx-coroutines-guava/test/ListenableFutureTest.kt
+++ b/integration/kotlinx-coroutines-guava/test/ListenableFutureTest.kt
@@ -236,7 +236,7 @@
         try {
             deferred.await()
             expectUnreached()
-        } catch (e: Exception) {
+        } catch (e: Throwable) {
             assertTrue(e is TestException)
         }
     }
@@ -252,7 +252,7 @@
         try {
             deferred.await()
             expectUnreached()
-        } catch (e: Exception) {
+        } catch (e: Throwable) {
             assertTrue(e is TestException)
         }
     }
@@ -273,6 +273,4 @@
         latch.countDown()
         return future
     }
-
-    private class TestException : Exception()
 }
diff --git a/integration/kotlinx-coroutines-jdk8/test/future/FutureExceptionsTest.kt b/integration/kotlinx-coroutines-jdk8/test/future/FutureExceptionsTest.kt
index d0662da..86b60e5 100644
--- a/integration/kotlinx-coroutines-jdk8/test/future/FutureExceptionsTest.kt
+++ b/integration/kotlinx-coroutines-jdk8/test/future/FutureExceptionsTest.kt
@@ -50,10 +50,8 @@
         testException(TestException(), { it is TestException }, { f -> f.thenApply { it + 1 } })
     }
 
-    class TestException : CompletionException("test2")
-
     private fun testException(
-        exception: Exception,
+        exception: Throwable,
         expected: ((Throwable) -> Boolean),
         transformer: (CompletableFuture<Int>) -> CompletableFuture<Int> = { it }
     ) {
@@ -65,7 +63,7 @@
             future.completeExceptionally(exception)
             try {
                 chained.await()
-            } catch (e: Exception) {
+            } catch (e: Throwable) {
                 assertTrue(expected(e))
             }
         }
@@ -81,7 +79,7 @@
 
             try {
                 chained.await()
-            } catch (e: Exception) {
+            } catch (e: Throwable) {
                 assertTrue(expected(e))
             }
         }
diff --git a/integration/kotlinx-coroutines-jdk8/test/future/FutureTest.kt b/integration/kotlinx-coroutines-jdk8/test/future/FutureTest.kt
index 72ba0f4..792cdcf 100644
--- a/integration/kotlinx-coroutines-jdk8/test/future/FutureTest.kt
+++ b/integration/kotlinx-coroutines-jdk8/test/future/FutureTest.kt
@@ -286,7 +286,7 @@
         try {
             deferred.await()
             fail("deferred.await() should throw an exception")
-        } catch (e: Exception) {
+        } catch (e: Throwable) {
             assertTrue(e is TestException)
             assertEquals("something went wrong", e.message)
         }
@@ -369,8 +369,6 @@
         return future
     }
 
-    class TestException(message: String) : Exception(message)
-
     private fun wrapContinuation(wrapper: (() -> Unit) -> Unit): CoroutineDispatcher = object : CoroutineDispatcher() {
         override fun dispatch(context: CoroutineContext, block: Runnable) {
             wrapper {
diff --git a/js/kotlinx-coroutines-core-js/test/PromiseTest.kt b/js/kotlinx-coroutines-core-js/test/PromiseTest.kt
index a431101..d0f6b2b 100644
--- a/js/kotlinx-coroutines-core-js/test/PromiseTest.kt
+++ b/js/kotlinx-coroutines-core-js/test/PromiseTest.kt
@@ -71,9 +71,7 @@
         val deferred = async { "OK" }
         val promise = deferred.asPromise()
         val d2 = promise.asDeferred()
-        assertTrue(d2 === deferred)
+        assertSame(d2, deferred)
         assertEquals("OK", d2.await())
     }
-
-    private class TestException(message: String) : Exception(message)
 }
\ No newline at end of file
diff --git a/reactive/kotlinx-coroutines-reactor/test/ConvertTest.kt b/reactive/kotlinx-coroutines-reactor/test/ConvertTest.kt
index 436f5f7..9bd55cd 100644
--- a/reactive/kotlinx-coroutines-reactor/test/ConvertTest.kt
+++ b/reactive/kotlinx-coroutines-reactor/test/ConvertTest.kt
@@ -11,8 +11,6 @@
 import org.junit.Assert.*
 
 class ConvertTest : TestBase() {
-    class TestException(s: String): RuntimeException(s)
-
     @Test
     fun testJobToMonoSuccess() = runBlocking {
         expect(1)
@@ -77,15 +75,15 @@
     fun testDeferredToMonoFail() {
         val d = GlobalScope.async {
             delay(50)
-            throw TestException("OK")
+            throw TestRuntimeException("OK")
         }
         val mono1 = d.asMono(Dispatchers.Unconfined)
         checkErroneous(mono1) {
-            check(it is TestException && it.message == "OK") { "$it" }
+            check(it is TestRuntimeException && it.message == "OK") { "$it" }
         }
         val mono2 = d.asMono(Dispatchers.Unconfined)
         checkErroneous(mono2) {
-            check(it is TestException && it.message == "OK") { "$it" }
+            check(it is TestRuntimeException && it.message == "OK") { "$it" }
         }
     }
 
diff --git a/reactive/kotlinx-coroutines-rx2/test/ConvertTest.kt b/reactive/kotlinx-coroutines-rx2/test/ConvertTest.kt
index b83ddd0..475ee57 100644
--- a/reactive/kotlinx-coroutines-rx2/test/ConvertTest.kt
+++ b/reactive/kotlinx-coroutines-rx2/test/ConvertTest.kt
@@ -10,8 +10,6 @@
 import org.junit.Assert.*
 
 class ConvertTest : TestBase() {
-    class TestException(s: String): RuntimeException(s)
-
     @Test
     fun testToCompletableSuccess() = runBlocking {
         expect(1)
@@ -75,15 +73,15 @@
     fun testToMaybeFail() {
         val d = GlobalScope.async {
             delay(50)
-            throw TestException("OK")
+            throw TestRuntimeException("OK")
         }
         val maybe1 = d.asMaybe(Dispatchers.Unconfined)
         checkErroneous(maybe1) {
-            check(it is TestException && it.message == "OK") { "$it" }
+            check(it is TestRuntimeException && it.message == "OK") { "$it" }
         }
         val maybe2 = d.asMaybe(Dispatchers.Unconfined)
         checkErroneous(maybe2) {
-            check(it is TestException && it.message == "OK") { "$it" }
+            check(it is TestRuntimeException && it.message == "OK") { "$it" }
         }
     }
 
@@ -107,15 +105,15 @@
     fun testToSingleFail() {
         val d = GlobalScope.async {
             delay(50)
-            throw TestException("OK")
+            throw TestRuntimeException("OK")
         }
         val single1 = d.asSingle(Dispatchers.Unconfined)
         checkErroneous(single1) {
-            check(it is TestException && it.message == "OK") { "$it" }
+            check(it is TestRuntimeException && it.message == "OK") { "$it" }
         }
         val single2 = d.asSingle(Dispatchers.Unconfined)
         checkErroneous(single2) {
-            check(it is TestException && it.message == "OK") { "$it" }
+            check(it is TestRuntimeException && it.message == "OK") { "$it" }
         }
     }