Skip to content

Commit 0b5cb57

Browse files
committed
Extract plantTestTimber
1 parent 95207ee commit 0b5cb57

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

features/call/impl/src/test/kotlin/io/element/android/features/call/utils/DefaultActiveCallManagerTest.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import io.element.android.libraries.push.test.notifications.push.FakeNotificatio
4141
import io.element.android.services.appnavstate.test.FakeAppForegroundStateService
4242
import io.element.android.tests.testutils.lambda.lambdaRecorder
4343
import io.element.android.tests.testutils.lambda.value
44+
import io.element.android.tests.testutils.plantTestTimber
4445
import io.mockk.coVerify
4546
import io.mockk.mockk
4647
import io.mockk.verify
@@ -53,7 +54,6 @@ import org.junit.Test
5354
import org.junit.runner.RunWith
5455
import org.robolectric.RobolectricTestRunner
5556
import org.robolectric.Shadows.shadowOf
56-
import timber.log.Timber
5757

5858
@RunWith(RobolectricTestRunner::class)
5959
class DefaultActiveCallManagerTest {
@@ -233,12 +233,7 @@ class DefaultActiveCallManagerTest {
233233
@OptIn(ExperimentalCoroutinesApi::class)
234234
@Test
235235
fun `Decline event - Should ignore decline for other notification events`() = runTest {
236-
Timber.plant(object : Timber.Tree() {
237-
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
238-
println("$tag: $message")
239-
}
240-
})
241-
236+
plantTestTimber()
242237
setupShadowPowerManager()
243238
val notificationManagerCompat = mockk<NotificationManagerCompat>(relaxed = true)
244239

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2025 New Vector Ltd.
3+
*
4+
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5+
* Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
package io.element.android.tests.testutils
9+
10+
import timber.log.Timber
11+
12+
fun plantTestTimber() {
13+
Timber.plant(object : Timber.Tree() {
14+
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
15+
println("$tag: $message")
16+
}
17+
})
18+
}

0 commit comments

Comments
 (0)