Skip to content

Commit feaa2c8

Browse files
committed
remove createContext from CompatUtils and CompatUtilsTest
1 parent 8ce2941 commit feaa2c8

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

app/src/main/kotlin/com/vrem/util/CompatUtils.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,9 @@ package com.vrem.util
2020
import android.content.Context
2121
import android.content.pm.PackageInfo
2222
import android.content.pm.PackageManager.PackageInfoFlags
23-
import android.content.res.Configuration
24-
import android.content.res.Resources
2523
import android.net.wifi.ScanResult
2624
import android.os.Build
2725
import androidx.annotation.RequiresApi
28-
import java.util.Locale
29-
30-
fun Context.createContext(newLocale: Locale): Context {
31-
val resources: Resources = resources
32-
val configuration: Configuration = resources.configuration
33-
configuration.setLocale(newLocale)
34-
return createConfigurationContext(configuration)
35-
}
3626

3727
fun Context.packageInfo(): PackageInfo =
3828
if (buildMinVersionT()) {

app/src/test/kotlin/com/vrem/util/CompatUtilsTest.kt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,6 @@ class CompatUtilsTest {
7979
verifyNoMoreInteractions(wifiSsid)
8080
}
8181

82-
@Test
83-
fun createContext() {
84-
// setup
85-
whenever(context.resources).thenReturn(resources)
86-
whenever(resources.configuration).thenReturn(configuration)
87-
whenever(context.createConfigurationContext(configuration)).thenReturn(contextWrapper)
88-
whenever(contextWrapper.baseContext).thenReturn(context)
89-
// execute
90-
val actual: Context = context.createContext(newLocale)
91-
// validate
92-
assertThat(actual).isEqualTo(contextWrapper)
93-
assertThat((actual as ContextWrapper).baseContext).isEqualTo(context)
94-
verify(configuration).setLocale(newLocale)
95-
verify(context).createConfigurationContext(configuration)
96-
verify(context).resources
97-
verify(contextWrapper).baseContext
98-
verify(resources).configuration
99-
}
100-
10182
@Test
10283
fun contextPackageInfo() {
10384
// setup

0 commit comments

Comments
 (0)