Skip to content

Commit ac92dbd

Browse files
ericli3690mikehardy
authored andcommitted
NF: get NotificationManager properly in test file
David let me know about a better way to retrieve the NotificationManager system service. I realized I used the old method in this test file and I've now fixed it.
1 parent 1e3fd03 commit ac92dbd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

AnkiDroid/src/androidTest/java/com/ichi2/anki/tests/NotificationChannelTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
package com.ichi2.anki.tests
1717

1818
import android.app.NotificationManager
19-
import android.content.Context
2019
import android.os.Build
20+
import androidx.core.content.getSystemService
2121
import androidx.test.annotation.UiThreadTest
2222
import androidx.test.ext.junit.runners.AndroidJUnit4
2323
import androidx.test.filters.SdkSuppress
@@ -54,7 +54,7 @@ class NotificationChannelTest : InstrumentedTest() {
5454
(targetContext.applicationContext as AnkiDroidApp).onCreate()
5555
currentAPI = sdkVersion
5656
targetAPI = targetContext.applicationInfo.targetSdkVersion
57-
manager = targetContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
57+
manager = targetContext.getSystemService<NotificationManager>()!!
5858
}
5959

6060
private fun channelsInAPI(): Boolean = currentAPI >= 26

0 commit comments

Comments
 (0)