Skip to content
Snippets Groups Projects
Unverified Commit e472d885 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Align behavior of toResolvingString with Context.getString (DEV) #2465


* Align behavior of toResolvingString with Context.getString

* Fix unit test mocking getString().

Co-authored-by: default avatarBMItter <46747780+BMItter@users.noreply.github.com>
parent 07603a5b
No related branches found
No related tags found
No related merge requests found
......@@ -19,5 +19,9 @@ fun String.toLazyString() = object : LazyString {
}
fun Int.toResolvingString(vararg formatArgs: Any): LazyString = object : LazyString {
override fun get(context: Context): String = context.getString(this@toResolvingString, *formatArgs)
override fun get(context: Context): String = if (formatArgs.isNotEmpty()) {
context.getString(this@toResolvingString, *formatArgs)
} else {
context.getString(this@toResolvingString)
}
}
......@@ -37,7 +37,7 @@ class AnalyticsUserInputViewModelTest : BaseTest() {
fun setup() {
MockKAnnotations.init(this)
every { context.getString(any(), *anyVararg()) } returns ""
every { context.getString(any()) } returns ""
every { analyticsSettings.userInfoAgeGroup } returns userInfoAgeGroup
every { analyticsSettings.userInfoFederalState } returns userInfoFederalState
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment