INNER CODE UNIT · Kotlin
DateFormattingTest
spacecowboy/Feeder · app/src/androidTest/java/com/nononsenseapps/feeder/DateFormattingTest.kt:25
class DateFormattingTest {
private lateinit var context: Context
private var originalTimeFormat: String? = null
@Before
fun setUp() {
val applicationContext = ApplicationProvider.getApplicationContext<Context>()
val configuration = Configuration(applicationContext.resources.configuration).apply { setLocale(Locale.US) }
context = applicationContext.createConfigurationContext(configuration)
originalTimeFormat = Settings.System.getString(context.contentResolver, Settings.System.TIME_12_24)
}
@After
fun tearDown() {
setTimeFormat(originalTimeFormat)
}
@Test