Skip to content

Commit 0b886a3

Browse files
committed
Get rid of TestException copy-paste
1 parent eaf9b7c commit 0b886a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+34
-127
lines changed

common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class AbstractCoroutineTest : TestBase() {
5858
}
5959

6060
override fun onCancellation(cause: Throwable?) {
61-
assertTrue(cause is TestException0)
61+
assertTrue(cause is TestException1)
6262
expect(5)
6363
}
6464

@@ -67,30 +67,27 @@ class AbstractCoroutineTest : TestBase() {
6767
}
6868

6969
override fun onCompletedExceptionally(exception: Throwable) {
70-
assertTrue(exception is TestException0)
70+
assertTrue(exception is TestException1)
7171
expect(9)
7272
}
7373
}
7474

7575
coroutine.invokeOnCompletion(onCancelling = true) {
76-
assertTrue(it is TestException0)
76+
assertTrue(it is TestException1)
7777
expect(6)
7878
}
7979

8080
coroutine.invokeOnCompletion {
81-
assertTrue(it is TestException0)
81+
assertTrue(it is TestException1)
8282
expect(8)
8383
}
8484

8585
expect(2)
8686
coroutine.start()
8787
expect(4)
88-
coroutine.cancel(TestException0())
88+
coroutine.cancel(TestException1())
8989
expect(7)
90-
coroutine.resumeWithException(TestException1())
90+
coroutine.resumeWithException(TestException2())
9191
finish(10)
9292
}
93-
94-
private class TestException0 : Throwable()
95-
private class TestException1 : Throwable()
9693
}

common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,4 @@ class AsyncLazyTest : TestBase() {
184184
assertEquals(d.await(), 42) // await shall throw CancellationException
185185
expectUnreached()
186186
}
187-
188-
private class TestException : Exception()
189187
}

common/kotlinx-coroutines-core-common/test/AsyncTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,4 @@ class AsyncTest : TestBase() {
238238
finish(3)
239239
}
240240
}
241-
242-
private class TestException : Exception()
243241
}

common/kotlinx-coroutines-core-common/test/AwaitTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,4 @@ class AwaitTest : TestBase() {
351351
async(NonCancellable) { throw TestException() }
352352
joinAll(job, job, job)
353353
}
354-
355-
private class TestException : Exception()
356354
}

common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,4 @@ class CancellableContinuationTest : TestBase() {
116116
continuation!!.resume(Unit) // Should not fail
117117
finish(4)
118118
}
119-
120-
private class TestException : Exception()
121119
}

common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,4 @@ class CompletableDeferredTest : TestBase() {
184184
assertTrue(e is T)
185185
}
186186
}
187-
188-
class TestException : Throwable()
189187
}

common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,4 @@ class CoroutineExceptionHandlerTest : TestBase() {
4444
assertTrue(parent.isCancelled)
4545
assertTrue(parent.getCompletionExceptionOrNull() is TestException)
4646
}
47-
48-
private class TestException: RuntimeException()
4947
}

common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,4 @@ class CoroutineScopeTest : TestBase() {
258258

259259
private fun scopePlusContext(c1: CoroutineContext, c2: CoroutineContext) =
260260
(ContextScope(c1) + c2).coroutineContext
261-
262-
private class TestException1 : Exception()
263-
private class TestException2 : Exception()
264261
}

common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,4 @@ class CoroutinesTest : TestBase() {
330330
}
331331

332332
private fun throwTestException() { throw TestException() }
333-
334-
private class TestException : Exception {
335-
constructor(message: String): super(message)
336-
constructor(): super()
337-
}
338333
}

common/kotlinx-coroutines-core-common/test/FailedJobTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,4 @@ class FailedJobTest : TestBase() {
5959
assertTrue(!job.isActive)
6060
assertTrue(job.isCancelled)
6161
}
62-
63-
private class TestException : Exception()
6462
}

0 commit comments

Comments
 (0)