diff --git a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 8d6807485d..5b9d401678 100644 --- a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -90,12 +90,13 @@ open class TestBaseWithProfile : TestBase() { json.put("store", store) return ProfileStore(profileInjector, json, dateUtil) } + fun getInvalidProfileStore2(): ProfileStore { val json = JSONObject() val store = JSONObject() store.put(TESTPROFILENAME, JSONObject(validProfileJSON)) store.put("invalid", JSONObject(invalidProfileJSON)) - json.put("defaultProfile", TESTPROFILENAME) + json.put("defaultProfile", TESTPROFILENAME + "invalid") json.put("store", store) return ProfileStore(profileInjector, json, dateUtil) } diff --git a/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt b/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt index cd5f464d24..3c9b826862 100644 --- a/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.data.PureProfile +import org.json.JSONObject import org.junit.Assert import org.junit.Test @@ -20,6 +21,7 @@ internal class ProfileStoreTest : TestBaseWithProfile() { @Test fun getDefaultProfileJsonTest() { Assert.assertTrue(getValidProfileStore().getDefaultProfileJson()?.has("dia") ?: false) + Assert.assertEquals(null, getInvalidProfileStore2().getDefaultProfileJson()) } @Test