This commit is contained in:
Milos Kozak 2022-09-17 21:34:37 +02:00
parent b5db6e613d
commit 89cf0271e0
2 changed files with 4 additions and 1 deletions

View file

@ -90,12 +90,13 @@ open class TestBaseWithProfile : TestBase() {
json.put("store", store) json.put("store", store)
return ProfileStore(profileInjector, json, dateUtil) return ProfileStore(profileInjector, json, dateUtil)
} }
fun getInvalidProfileStore2(): ProfileStore { fun getInvalidProfileStore2(): ProfileStore {
val json = JSONObject() val json = JSONObject()
val store = JSONObject() val store = JSONObject()
store.put(TESTPROFILENAME, JSONObject(validProfileJSON)) store.put(TESTPROFILENAME, JSONObject(validProfileJSON))
store.put("invalid", JSONObject(invalidProfileJSON)) store.put("invalid", JSONObject(invalidProfileJSON))
json.put("defaultProfile", TESTPROFILENAME) json.put("defaultProfile", TESTPROFILENAME + "invalid")
json.put("store", store) json.put("store", store)
return ProfileStore(profileInjector, json, dateUtil) return ProfileStore(profileInjector, json, dateUtil)
} }

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.data.PureProfile import info.nightscout.androidaps.data.PureProfile
import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -20,6 +21,7 @@ internal class ProfileStoreTest : TestBaseWithProfile() {
@Test @Test
fun getDefaultProfileJsonTest() { fun getDefaultProfileJsonTest() {
Assert.assertTrue(getValidProfileStore().getDefaultProfileJson()?.has("dia") ?: false) Assert.assertTrue(getValidProfileStore().getDefaultProfileJson()?.has("dia") ?: false)
Assert.assertEquals(null, getInvalidProfileStore2().getDefaultProfileJson())
} }
@Test @Test