Try to fix test, Probably a bit better but doesn't work
This commit is contained in:
parent
400f55f3d9
commit
afa64d0111
1 changed files with 8 additions and 4 deletions
|
@ -1,8 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.general.maintenance.formats
|
package info.nightscout.androidaps.plugins.general.maintenance.formats
|
||||||
|
|
||||||
import info.nightscout.androidaps.TestBase
|
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.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
@ -18,14 +20,16 @@ import java.io.File
|
||||||
class ClassicPrefsFormatTest : TestBase() {
|
class ClassicPrefsFormatTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var resourceHelper: ResourceHelper
|
@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
|
@Mock lateinit var file: MockedFile
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun preferenceLoadingTest() {
|
fun preferenceLoadingTest() {
|
||||||
val test = "key1::val1\nkeyB::valB"
|
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(), "")
|
val prefs = classicFormat.loadPreferences(getMockedFile(), "")
|
||||||
|
|
||||||
Assert.assertEquals(prefs.values.size, 2)
|
Assert.assertEquals(prefs.values.size, 2)
|
||||||
|
@ -37,7 +41,7 @@ class ClassicPrefsFormatTest : TestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun preferenceSavingTest() {
|
fun preferenceSavingTest() {
|
||||||
val storage = SingleStringStorage("")
|
val storage = SingleStringStorage("")
|
||||||
val classicFormat = ClassicPrefsFormat(resourceHelper, storage)
|
val classicFormat = ClassicPrefsFormat(resourceHelper, dateUtil, translator, profileFunction, storage)
|
||||||
val prefs = Prefs(
|
val prefs = Prefs(
|
||||||
mapOf(
|
mapOf(
|
||||||
"key1" to "A",
|
"key1" to "A",
|
||||||
|
|
Loading…
Reference in a new issue