Replace deprecated RuntimeEnvironment.application
This commit is contained in:
parent
cd2a89ebdb
commit
76678057ad
2 changed files with 5 additions and 4 deletions
|
@ -15,6 +15,7 @@ dependencies {
|
|||
testImplementation project(':app:testing')
|
||||
testImplementation project(":backend:imap")
|
||||
testImplementation "org.robolectric:robolectric:${versions.robolectric}"
|
||||
testImplementation "androidx.test:core:${versions.androidxCore}"
|
||||
testImplementation "junit:junit:${versions.junit}"
|
||||
testImplementation "com.google.truth:truth:${versions.truth}"
|
||||
testImplementation "org.mockito:mockito-core:${versions.mockito}"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.fsck.k9.autodiscovery.providersxml
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import com.fsck.k9.RobolectricTest
|
||||
import com.fsck.k9.autodiscovery.DiscoveryTarget
|
||||
import com.fsck.k9.backend.BackendManager
|
||||
|
@ -12,17 +13,16 @@ import com.nhaarman.mockitokotlin2.doAnswer
|
|||
import com.nhaarman.mockitokotlin2.mock
|
||||
import org.junit.Test
|
||||
import org.mockito.ArgumentMatchers.anyString
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
|
||||
class ProvidersXmlDiscoveryTest : RobolectricTest() {
|
||||
val backendManager = mock<BackendManager> {
|
||||
private val backendManager = mock<BackendManager> {
|
||||
on { decodeStoreUri(anyString()) } doAnswer { mock -> ImapStoreUriDecoder.decode(mock.getArgument(0)) }
|
||||
on { decodeTransportUri(anyString()) } doAnswer { mock ->
|
||||
SmtpTransportUriDecoder.decodeSmtpUri(mock.getArgument(0))
|
||||
}
|
||||
}
|
||||
val xmlProvider = ProvidersXmlProvider(RuntimeEnvironment.application)
|
||||
val providersXmlDiscovery = ProvidersXmlDiscovery(backendManager, xmlProvider)
|
||||
private val xmlProvider = ProvidersXmlProvider(ApplicationProvider.getApplicationContext())
|
||||
private val providersXmlDiscovery = ProvidersXmlDiscovery(backendManager, xmlProvider)
|
||||
|
||||
@Test
|
||||
fun discover_withGmailDomain_shouldReturnCorrectSettings() {
|
||||
|
|
Loading…
Reference in a new issue