Try to fix test, Probably a bit better but doesn't work

This commit is contained in:
Philoul 2021-03-18 23:01:31 +01:00
parent 400f55f3d9
commit afa64d0111

View file

@ -1,8 +1,10 @@
package info.nightscout.androidaps.plugins.general.maintenance.formats
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@ -18,14 +20,16 @@ import java.io.File
class ClassicPrefsFormatTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var sp: SP
@Mock lateinit var dateUtil: DateUtil
@Mock lateinit var translator: Translator
@Mock lateinit var profileFunction: ProfileFunction
@Mock lateinit var file: MockedFile
@Test
fun preferenceLoadingTest() {
val test = "key1::val1\nkeyB::valB"
val classicFormat = ClassicPrefsFormat(resourceHelper, SingleStringStorage(test))
val classicFormat = ClassicPrefsFormat(resourceHelper, dateUtil, translator, profileFunction, SingleStringStorage(test))
val prefs = classicFormat.loadPreferences(getMockedFile(), "")
Assert.assertEquals(prefs.values.size, 2)
@ -37,7 +41,7 @@ class ClassicPrefsFormatTest : TestBase() {
@Test
fun preferenceSavingTest() {
val storage = SingleStringStorage("")
val classicFormat = ClassicPrefsFormat(resourceHelper, storage)
val classicFormat = ClassicPrefsFormat(resourceHelper, dateUtil, translator, profileFunction, storage)
val prefs = Prefs(
mapOf(
"key1" to "A",