diff --git a/app-wear-shared/shared-impl/src/main/java/info/nightscout/shared/impl/logging/LImpl.kt b/app-wear-shared/shared-impl/src/main/java/info/nightscout/shared/impl/logging/LImpl.kt index 595a8c3da7..09790a0fc3 100644 --- a/app-wear-shared/shared-impl/src/main/java/info/nightscout/shared/impl/logging/LImpl.kt +++ b/app-wear-shared/shared-impl/src/main/java/info/nightscout/shared/impl/logging/LImpl.kt @@ -53,7 +53,7 @@ class LImpl @Inject constructor( internal constructor(defaultValue: Boolean, sp: SP) { this.sp = sp - name = "NONEXISTING" + name = "NONEXISTENT" this.defaultValue = defaultValue enabled = defaultValue } diff --git a/app-wear-shared/shared-impl/src/test/kotlin/info/nightscout/shared/impl/logging/LImplTest.kt b/app-wear-shared/shared-impl/src/test/kotlin/info/nightscout/shared/impl/logging/LImplTest.kt new file mode 100644 index 0000000000..f2109a07b6 --- /dev/null +++ b/app-wear-shared/shared-impl/src/test/kotlin/info/nightscout/shared/impl/logging/LImplTest.kt @@ -0,0 +1,40 @@ +package info.nightscout.shared.impl.logging + +import info.nightscout.androidaps.TestBase +import info.nightscout.rx.logging.LTag +import info.nightscout.shared.sharedPreferences.SP +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.mockito.Mock + +class LImplTest : TestBase() { + + @Mock lateinit var sp: SP + + private lateinit var sut: LImpl + + @BeforeEach + fun setUp() { + sut = LImpl(sp) + } + + @Test + fun findByName() { + Assertions.assertEquals(LTag.APS.name, sut.findByName("APS").name) + Assertions.assertEquals("NONEXISTENT", sut.findByName("APS2").name) + } + + @Test + fun getLogElements() { + Assertions.assertTrue(sut.getLogElements().isNotEmpty()) + } + + @Test + fun resetToDefaults() { + val element = sut.findByName("APS") + element.enabled = false + sut.resetToDefaults() + Assertions.assertTrue(element.enabled) + } +} \ No newline at end of file