diff --git a/app-wear-shared/shared/src/main/res/values-es-rES/strings.xml b/app-wear-shared/shared/src/main/res/values-es-rES/strings.xml
index 026bf80160..612aa4de1c 100644
--- a/app-wear-shared/shared/src/main/res/values-es-rES/strings.xml
+++ b/app-wear-shared/shared/src/main/res/values-es-rES/strings.xml
@@ -48,9 +48,9 @@
Mostrar delta detallado
Mostrar delta promedio
Mostrar batería del teléfono
- Mostrar batería global del lazo
+ Mostrar batería global del bucle
Mostrar la tasa basal
- Mostrar estado del lazo
+ Mostrar estado del bucle
Mostrar glucosa
Mostrar BGI (Índice de glucosa en sangre)
Mostrar flecha de dirección
@@ -72,7 +72,7 @@
Delta corto de glucosa
Delta promedio de glucosa (15min)
Batería del teléfono (%)
- Batería global de lazo (%)
+ Batería global de bucle(%)
Tasa Basal
Valor BGI
Tiempo (HH:MM o HH:MM:SS)
diff --git a/app-wear-shared/shared/src/main/res/values-fr-rFR/strings.xml b/app-wear-shared/shared/src/main/res/values-fr-rFR/strings.xml
index d5b3b0ac07..d5f9159194 100644
--- a/app-wear-shared/shared/src/main/res/values-fr-rFR/strings.xml
+++ b/app-wear-shared/shared/src/main/res/values-fr-rFR/strings.xml
@@ -55,6 +55,7 @@
Afficher IGly
Afficher Flèche
Afficher Min Passées
+ Afficher numéro semaine
Cadran par défaut, vous pouvez cliquer sur le bouton EXPORTER WATCHFACE pour générer un modèle
Cadran par défaut
Image d\'arrière-plan
@@ -81,6 +82,7 @@
AM ou PM
Nom du jour de la semaine
Jour (JJ)
+ Numéro de semaine (ww)
Nom du mois (court)
État de la boucle et délais
Flèche de direction
diff --git a/app/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt b/app/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt
index 7f74063515..be9f2417c5 100644
--- a/app/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt
+++ b/app/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt
@@ -2,6 +2,7 @@ package info.nightscout.plugins.aps.loop
import android.app.NotificationManager
import android.content.Context
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.core.utils.fabric.FabricPrivacy
@@ -25,7 +26,6 @@ import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil
import info.nightscout.sharedtests.TestBase
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -74,28 +74,28 @@ class LoopPluginTest : TestBase() {
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
val pumpDescription = PumpDescription()
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
- Assertions.assertEquals(LoopFragment::class.java.name, loopPlugin.pluginDescription.fragmentClass)
- Assertions.assertEquals(PluginType.LOOP, loopPlugin.getType())
- Assertions.assertEquals("Loop", loopPlugin.name)
- Assertions.assertEquals("LOOP", loopPlugin.nameShort)
- Assertions.assertEquals(true, loopPlugin.hasFragment())
- Assertions.assertEquals(true, loopPlugin.showInList(PluginType.LOOP))
- Assertions.assertEquals(info.nightscout.plugins.aps.R.xml.pref_loop.toLong(), loopPlugin.preferencesId.toLong())
+ assertThat(loopPlugin.pluginDescription.fragmentClass).isEqualTo(LoopFragment::class.java.name)
+ assertThat(loopPlugin.getType()).isEqualTo(PluginType.LOOP)
+ assertThat(loopPlugin.name).isEqualTo("Loop")
+ assertThat(loopPlugin.nameShort).isEqualTo("LOOP")
+ assertThat(loopPlugin.hasFragment()).isTrue()
+ assertThat(loopPlugin.showInList(PluginType.LOOP)).isTrue()
+ assertThat(loopPlugin.preferencesId.toLong()).isEqualTo(info.nightscout.plugins.aps.R.xml.pref_loop.toLong())
// Plugin is disabled by default
- Assertions.assertEquals(false, loopPlugin.isEnabled())
+ assertThat(loopPlugin.isEnabled()).isFalse()
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
- Assertions.assertEquals(true, loopPlugin.isEnabled())
+ assertThat(loopPlugin.isEnabled()).isTrue()
// No temp basal capable pump should disable plugin
virtualPumpPlugin.pumpDescription.isTempBasalCapable = false
- Assertions.assertEquals(false, loopPlugin.isEnabled())
+ assertThat(loopPlugin.isEnabled()).isFalse()
virtualPumpPlugin.pumpDescription.isTempBasalCapable = true
// Fragment is hidden by default
- Assertions.assertEquals(false, loopPlugin.isFragmentVisible())
+ assertThat(loopPlugin.isFragmentVisible()).isFalse()
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
- Assertions.assertEquals(true, loopPlugin.isFragmentVisible())
+ assertThat(loopPlugin.isFragmentVisible()).isTrue()
}
/* *********** not working
@@ -118,7 +118,7 @@ class LoopPluginTest : TestBase() {
MockedLoopPlugin mockedLoopPlugin = new MockedLoopPlugin();
Treatment t = new Treatment();
bus.post(new EventTreatmentChange(t));
- Assertions.assertEquals(true, mockedLoopPlugin.invokeCalled);
+ assertThat(mockedLoopPlugin.invokeCalled).isTrue();
}
*/
-}
\ No newline at end of file
+}
diff --git a/app/src/test/java/info/nightscout/plugins/general/maintenance/MaintenancePluginTest.kt b/app/src/test/java/info/nightscout/plugins/general/maintenance/MaintenancePluginTest.kt
index 473eddd5e3..380f8f167f 100644
--- a/app/src/test/java/info/nightscout/plugins/general/maintenance/MaintenancePluginTest.kt
+++ b/app/src/test/java/info/nightscout/plugins/general/maintenance/MaintenancePluginTest.kt
@@ -1,6 +1,7 @@
package info.nightscout.plugins.general.maintenance
import android.content.Context
+import com.google.common.truth.Truth.assertThat
import dagger.android.HasAndroidInjector
import info.nightscout.configuration.maintenance.MaintenancePlugin
import info.nightscout.interfaces.Config
@@ -10,7 +11,6 @@ import info.nightscout.interfaces.nsclient.NSSettingsStatus
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.sharedtests.TestBase
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -40,11 +40,12 @@ class MaintenancePluginTest : TestBase() {
@Test fun logFilesTest() {
var logs = sut.getLogFiles(2)
- Assertions.assertEquals(2, logs.size)
- Assertions.assertEquals("AndroidAPS.log", logs[0].name)
- Assertions.assertEquals("AndroidAPS.2018-01-03_01-01-00.1.zip", logs[1].name)
+ assertThat(logs.map { it.name }).containsExactly(
+ "AndroidAPS.log",
+ "AndroidAPS.2018-01-03_01-01-00.1.zip",
+ ).inOrder()
logs = sut.getLogFiles(10)
- Assertions.assertEquals(4, logs.size)
+ assertThat(logs).hasSize(4)
}
@Test
@@ -53,7 +54,7 @@ class MaintenancePluginTest : TestBase() {
val name = "AndroidAPS.log.zip"
var zipFile = File("build/$name")
zipFile = sut.zipLogs(zipFile, logs)
- Assertions.assertTrue(zipFile.exists())
- Assertions.assertTrue(zipFile.isFile)
+ assertThat(zipFile.exists()).isTrue()
+ assertThat(zipFile.isFile).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/app/src/test/java/info/nightscout/plugins/sensitivity/AbstractSensitivityPluginTest.kt b/app/src/test/java/info/nightscout/plugins/sensitivity/AbstractSensitivityPluginTest.kt
index 250d142408..eb94a9e2ca 100644
--- a/app/src/test/java/info/nightscout/plugins/sensitivity/AbstractSensitivityPluginTest.kt
+++ b/app/src/test/java/info/nightscout/plugins/sensitivity/AbstractSensitivityPluginTest.kt
@@ -1,5 +1,6 @@
package info.nightscout.plugins.sensitivity
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.aps.AutosensDataStore
@@ -12,7 +13,6 @@ import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.sharedtests.TestBase
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -45,12 +45,12 @@ class AbstractSensitivityPluginTest : TestBase() {
fun fillResultTest() {
val sut = SensitivityTestClass(pluginDescription, aapsLogger, rh, sp)
var ar = sut.fillResult(1.0, 1.0, "1", "1.2", "1", 12, 0.7, 1.2)
- Assertions.assertEquals(1.0, ar.ratio, 0.01)
+ assertThat(ar.ratio).isWithin(0.01).of(1.0)
ar = sut.fillResult(1.2, 1.0, "1", "1.2", "1", 40, 0.7, 1.2)
- Assertions.assertEquals(1.16, ar.ratio, 0.01)
+ assertThat(ar.ratio).isWithin(0.01).of(1.16)
ar = sut.fillResult(1.2, 1.0, "1", "1.2", "1", 50, 0.7, 1.2)
- Assertions.assertEquals(1.2, ar.ratio, 0.01)
+ assertThat(ar.ratio).isWithin(0.01).of(1.2)
ar = sut.fillResult(1.2, 1.0, "1", "1.2", "1", 50, 0.7, 1.1)
- Assertions.assertEquals(1.1, ar.ratio, 0.01)
+ assertThat(ar.ratio).isWithin(0.01).of(1.1)
}
-}
\ No newline at end of file
+}
diff --git a/app/src/test/java/info/nightscout/pump/PumpEnactResultTest.kt b/app/src/test/java/info/nightscout/pump/PumpEnactResultTest.kt
index cb6f88c370..11d61c0d0f 100644
--- a/app/src/test/java/info/nightscout/pump/PumpEnactResultTest.kt
+++ b/app/src/test/java/info/nightscout/pump/PumpEnactResultTest.kt
@@ -1,5 +1,6 @@
package info.nightscout.pump
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.core.pump.toHtml
@@ -8,7 +9,6 @@ import info.nightscout.plugins.aps.loop.extensions.json
import info.nightscout.pump.virtual.extensions.toText
import info.nightscout.sharedtests.TestBaseWithProfile
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
@@ -42,132 +42,132 @@ class PumpEnactResultTest : TestBaseWithProfile() {
val per = PumpEnactResult(injector)
per.success(true)
- Assertions.assertEquals(true, per.success)
+ assertThat(per.success).isTrue()
}
@Test fun enactedTest() {
val per = PumpEnactResult(injector)
per.enacted(true)
- Assertions.assertEquals(true, per.enacted)
+ assertThat(per.enacted).isTrue()
}
@Test fun commentTest() {
val per = PumpEnactResult(injector)
per.comment("SomeComment")
- Assertions.assertEquals("SomeComment", per.comment)
+ assertThat(per.comment).isEqualTo("SomeComment")
}
@Test fun durationTest() {
val per = PumpEnactResult(injector)
per.duration(10)
- Assertions.assertEquals(10, per.duration.toLong())
+ assertThat(per.duration.toLong()).isEqualTo(10L)
}
@Test fun absoluteTest() {
val per = PumpEnactResult(injector)
per.absolute(11.0)
- Assertions.assertEquals(11.0, per.absolute, 0.01)
+ assertThat(per.absolute).isWithin(0.01).of(11.0)
}
@Test fun percentTest() {
val per = PumpEnactResult(injector)
per.percent(10)
- Assertions.assertEquals(10, per.percent)
+ assertThat(per.percent).isEqualTo(10)
}
@Test fun isPercentTest() {
val per = PumpEnactResult(injector)
per.isPercent(true)
- Assertions.assertEquals(true, per.isPercent)
+ assertThat(per.isPercent).isTrue()
}
@Test fun isTempCancelTest() {
val per = PumpEnactResult(injector)
per.isTempCancel(true)
- Assertions.assertEquals(true, per.isTempCancel)
+ assertThat(per.isTempCancel).isTrue()
}
@Test fun bolusDeliveredTest() {
val per = PumpEnactResult(injector)
per.bolusDelivered(11.0)
- Assertions.assertEquals(11.0, per.bolusDelivered, 0.01)
+ assertThat(per.bolusDelivered).isWithin(0.01).of(11.0)
}
@Test fun queuedTest() {
val per = PumpEnactResult(injector)
per.queued(true)
- Assertions.assertEquals(true, per.queued)
+ assertThat(per.queued).isTrue()
}
@Test fun toStringTest() {
var per = PumpEnactResult(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
- Assertions.assertEquals(
+ assertThat(per.toText(rh)).isEqualTo(
"""
Success: false
Enacted: true
Comment: AAA
Insulin: 10.0 U
- """.trimIndent(), per.toText(rh)
+ """.trimIndent()
)
per = PumpEnactResult(injector).enacted(true).isTempCancel(true).comment("AAA")
- Assertions.assertEquals(
+ assertThat(per.toText(rh)).isEqualTo(
"""
Success: false
Enacted: true
Comment: AAA
Cancel temp basal
- """.trimIndent(), per.toText(rh)
+ """.trimIndent()
)
per = PumpEnactResult(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
- Assertions.assertEquals(
+ assertThat(per.toText(rh)).isEqualTo(
"""
Success: false
Enacted: true
Comment: AAA
Duration: 20 min
Percent: 90%
- """.trimIndent(), per.toText(rh)
+ """.trimIndent()
)
per = PumpEnactResult(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
- Assertions.assertEquals(
+ assertThat(per.toText(rh)).isEqualTo(
"""
Success: false
Enacted: true
Comment: AAA
Duration: 30 min
Absolute: 1.0 U/h
- """.trimIndent(), per.toText(rh)
+ """.trimIndent()
)
per = PumpEnactResult(injector).enacted(false).comment("AAA")
- Assertions.assertEquals(
+ assertThat(per.toText(rh)).isEqualTo(
"""
Success: false
Comment: AAA
- """.trimIndent(), per.toText(rh)
+ """.trimIndent()
)
}
@Test fun toHtmlTest() {
var per: PumpEnactResult = PumpEnactResult(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
- Assertions.assertEquals("Success: false
Enacted: true
Comment: AAA
SMB: 10.0 U", per.toHtml(rh, decimalFormatter))
+ assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("Success: false
Enacted: true
Comment: AAA
SMB: 10.0 U")
per = PumpEnactResult(injector).enacted(true).isTempCancel(true).comment("AAA")
- Assertions.assertEquals("Success: false
Enacted: true
Comment: AAA
Cancel temp basal", per.toHtml(rh, decimalFormatter))
+ assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("Success: false
Enacted: true
Comment: AAA
Cancel temp basal")
per = PumpEnactResult(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
- Assertions.assertEquals("Success: false
Enacted: true
Comment: AAA
Duration: 20 min
Percent: 90%", per.toHtml(rh, decimalFormatter))
+ assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("Success: false
Enacted: true
Comment: AAA
Duration: 20 min
Percent: 90%")
per = PumpEnactResult(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
- Assertions.assertEquals("Success: false
Enacted: true
Comment: AAA
Duration: 30 min
Absolute: 1.00 U/h", per.toHtml(rh, decimalFormatter))
+ assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("Success: false
Enacted: true
Comment: AAA
Duration: 30 min
Absolute: 1.00 U/h")
per = PumpEnactResult(injector).enacted(false).comment("AAA")
- Assertions.assertEquals("Success: false
Comment: AAA", per.toHtml(rh, decimalFormatter))
+ assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("Success: false
Comment: AAA")
}
@Test fun jsonTest() {
@@ -175,15 +175,15 @@ class PumpEnactResultTest : TestBaseWithProfile() {
var per: PumpEnactResult = PumpEnactResult(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
o = per.json(validProfile.getBasal())
- JSONAssert.assertEquals("{\"smb\":10}", o, false)
+ JSONAssert.assertEquals("""{"smb":10}""", o, false)
per = PumpEnactResult(injector).enacted(true).isTempCancel(true).comment("AAA")
o = per.json(validProfile.getBasal())
- JSONAssert.assertEquals("{\"rate\":0,\"duration\":0}", o, false)
+ JSONAssert.assertEquals("""{"rate":0,"duration":0}""", o, false)
per = PumpEnactResult(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
o = per.json(validProfile.getBasal())
- JSONAssert.assertEquals("{\"rate\":0.9,\"duration\":20}", o, false)
+ JSONAssert.assertEquals("""{"rate":0.9,"duration":20}""", o, false)
per = PumpEnactResult(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
o = per.json(validProfile.getBasal())
- JSONAssert.assertEquals("{\"rate\":1,\"duration\":30}", o, false)
+ JSONAssert.assertEquals("""{"rate":1,"duration":30}""", o, false)
}
-}
\ No newline at end of file
+}
diff --git a/core/main/src/main/res/values-fr-rFR/strings.xml b/core/main/src/main/res/values-fr-rFR/strings.xml
index 3ea04e700d..ddc4b0eb74 100644
--- a/core/main/src/main/res/values-fr-rFR/strings.xml
+++ b/core/main/src/main/res/values-fr-rFR/strings.xml
@@ -1,2 +1,4 @@
-
+
+ %1$d g
+
diff --git a/core/ui/src/main/res/values-es-rES/strings.xml b/core/ui/src/main/res/values-es-rES/strings.xml
index 5804d89e91..741d18f0a8 100644
--- a/core/ui/src/main/res/values-es-rES/strings.xml
+++ b/core/ui/src/main/res/values-es-rES/strings.xml
@@ -17,7 +17,7 @@
Bolo %1$.2fU entregado correctamente
Tasa basal no válida leída en la bomba
Limitando IOB a %1$.1f U debido a %2$s
- LAZO DESACTIVADO POR RESTRICCIONES
+ BUCLE DESACTIVADO POR RESTRICCIONES
Tipo de evento
Recargar
mg/dl
@@ -86,11 +86,11 @@
Hora actualizada en la bomba
Salir
Eliminar registro
- Lazo desactivado
+ Bucle desactivado
Alarma
- Desactivar lazo
- Activar lazo
- Reanudar el lazo
+ Desactivar bucle
+ Activar bucle
+ Reanudar el bucle
Suspender lazo
Duración [min]
Notificación
@@ -118,7 +118,7 @@
g
Bomba parada
Sin configurar
- Lazo suspendido
+ Bucle suspendido
Flecha de tendencia
Auto sens
req
@@ -156,8 +156,8 @@
Cebar/Llenar
Insulina
Detener objetivo temporal
- Lazo cerrado
- Lazo abierto
+ Bucle cerrado
+ Bucle abierto
Suspensión por glucosa baja (LGS)
DIA
IC
@@ -165,7 +165,7 @@
Error cancelando la basal temporal
Error cancelando el bolo extendido
Subir estado de la bomba a NS o Tidepool
- Desactiva/suspende el lazo
+ Desactiva/suspende el bucle
Insulina a bordo (IOB)
Contraseña incorrecta
@@ -234,7 +234,7 @@
Reloj
Automatización
Personalizado
- Lazo
+ Bucle
NS
Registro
@@ -278,11 +278,11 @@
GUARDAR PERFIL
CAMBIO DE PERFIL
CAMBIO DE PERFIL CLONADO
- MODO LAZO CERRADO
- MODO LAZO LGS
- MODO LAZO ABIERTO
- LAZO DESACTIVADO
- LAZO ACTIVADO
+ MODO BUCLE CERRADO
+ MODO BUCLE LGS
+ MODO BUCLE ABIERTO
+ BUCLE DESACTIVADO
+ BUCLE ACTIVADO
RECONECTAR
DESCONECTAR
REANUDAR
@@ -353,8 +353,8 @@
Acción
Fecha y hora
Sin Unidad
- LAZO CAMBIADO
- LAZO ELIMINADO
+ BUCLE CAMBIADO
+ BUCLE ELIMINADO
OTROS
Perfil de objetivo bajo
diff --git a/core/ui/src/main/res/values-fr-rFR/strings.xml b/core/ui/src/main/res/values-fr-rFR/strings.xml
index 723f667f4e..cf47d1c752 100644
--- a/core/ui/src/main/res/values-fr-rFR/strings.xml
+++ b/core/ui/src/main/res/values-fr-rFR/strings.xml
@@ -581,6 +581,22 @@
Voulez-vous nettoyer la base de données ?\nCela supprimera les modifications suivies et les données historiques de plus de 3 mois.\nCela accélérera la synchronisation complète de manière spectaculaire.
Entrées effacées
+ Dim
+ Sam
+ Ven
+ Jeu
+ Mer
+ Mar
+ Lun
+ L
+ M
+ M
+ J
+ V
+ S
+ D
+ %1$.1f U
+ %1$.2f U
diff --git a/core/ui/src/main/res/values-nl-rNL/strings.xml b/core/ui/src/main/res/values-nl-rNL/strings.xml
index 4a7e9ffa8f..33d11dab33 100644
--- a/core/ui/src/main/res/values-nl-rNL/strings.xml
+++ b/core/ui/src/main/res/values-nl-rNL/strings.xml
@@ -581,6 +581,22 @@
Wil je de database opschonen?\nHet zal bijgehouden wijzigingen en historische gegevens ouder dan 3 maanden verwijderen.\nDit zal de volledige synchronisatie drastisch versnellen.
Invoer gewist
+ Zo
+ Za
+ Vr
+ Do
+ Wo
+ Di
+ Ma
+ M
+ D
+ W
+ D
+ V
+ Z
+ Z
+ %1$.1f E
+ %1$.2f E
diff --git a/core/ui/src/main/res/values-no-rNO/strings.xml b/core/ui/src/main/res/values-no-rNO/strings.xml
index 62b2a77fe3..f3e1ef9956 100644
--- a/core/ui/src/main/res/values-no-rNO/strings.xml
+++ b/core/ui/src/main/res/values-no-rNO/strings.xml
@@ -581,6 +581,22 @@
Vil du rydde opp i databasen?\nDet vil fjerne sporede endringer og historiske data eldre enn 3 måneder.\nÅ gjøre dette vil øke hastigheten på synkronisering betydelig.
Fjernet oppføringer
+ Søn
+ Lør
+ Fre
+ Tor
+ Ons
+ Tir
+ Man
+ M
+ Ti
+ O
+ To
+ F
+ L
+ S
+ %1$.1f E
+ %1$.2f E
diff --git a/implementation/src/test/java/info/nightscout/implementation/iob/GlucoseStatusTest.kt b/implementation/src/test/java/info/nightscout/implementation/iob/GlucoseStatusTest.kt
index fb98cd1aaa..8d96814e6e 100644
--- a/implementation/src/test/java/info/nightscout/implementation/iob/GlucoseStatusTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/iob/GlucoseStatusTest.kt
@@ -1,5 +1,6 @@
package info.nightscout.implementation.iob
+import com.google.common.truth.Truth.assertThat
import info.nightscout.core.iob.asRounded
import info.nightscout.core.iob.log
import info.nightscout.database.entities.GlucoseValue
@@ -9,7 +10,6 @@ import info.nightscout.interfaces.iob.InMemoryGlucoseValue
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.shared.utils.T
import info.nightscout.sharedtests.TestBaseWithProfile
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -30,106 +30,106 @@ class GlucoseStatusTest : TestBaseWithProfile() {
@Test fun toStringShouldBeOverloaded() {
val glucoseStatus = GlucoseStatus(glucose = 0.0, noise = 0.0, delta = 0.0, shortAvgDelta = 0.0, longAvgDelta = 0.0, date = 0)
- Assertions.assertEquals(true, glucoseStatus.log(decimalFormatter).contains("Delta"))
+ assertThat(glucoseStatus.log(decimalFormatter)).contains("Delta")
}
@Test fun roundTest() {
val glucoseStatus = GlucoseStatus(glucose = 100.11111, noise = 0.0, delta = 0.0, shortAvgDelta = 0.0, longAvgDelta = 0.0, date = 0)
- Assertions.assertEquals(100.1, glucoseStatus.asRounded().glucose, 0.0001)
+ assertThat(glucoseStatus.asRounded().glucose).isWithin(0.0001).of(100.1)
}
@Test fun calculateValidGlucoseStatus() {
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateValidBgData())
val glucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData!!
- Assertions.assertEquals(214.0, glucoseStatus.glucose, 0.001)
- Assertions.assertEquals(-2.0, glucoseStatus.delta, 0.001)
- Assertions.assertEquals(-2.5, glucoseStatus.shortAvgDelta, 0.001) // -2 -2.5 -3 deltas are relative to current value
- Assertions.assertEquals(-2.0, glucoseStatus.longAvgDelta, 0.001) // -2 -2 -2 -2
- Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date
+ assertThat(glucoseStatus.glucose).isWithin(0.001).of(214.0)
+ assertThat(glucoseStatus.delta).isWithin(0.001).of(-2.0)
+ assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(-2.5) // -2 -2.5 -3 deltas are relative to current value
+ assertThat(glucoseStatus.longAvgDelta).isWithin(0.001).of(-2.0) // -2 -2 -2 -2
+ assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date
}
-/*
- Not testing anymore, not valid for bucketed data
+ /*
+ Not testing anymore, not valid for bucketed data
- @Test fun calculateMostRecentGlucoseStatus() {
- Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateMostRecentBgData())
- val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
- Assertions.assertEquals(215.0, glucoseStatus.glucose, 0.001) // (214+216) / 2
- Assertions.assertEquals(-1.0, glucoseStatus.delta, 0.001)
- Assertions.assertEquals(-1.0, glucoseStatus.shortAvgDelta, 0.001)
- Assertions.assertEquals(0.0, glucoseStatus.longAvgDelta, 0.001)
- Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date, even when averaging
- }
+ @Test fun calculateMostRecentGlucoseStatus() {
+ Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateMostRecentBgData())
+ val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
+ assertThat(glucoseStatus.glucose).isWithin(0.001).of(215.0) // (214+216) / 2
+ assertThat(glucoseStatus.delta).isWithin(0.001).of(-1.0)
+ assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(-1.0)
+ assertThat( glucoseStatus.longAvgDelta).isWithin(0.001).of(0.0)
+ assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date, even when averaging
+ }
- private fun generateMostRecentBgData(): MutableList {
- val list: MutableList = ArrayList()
- list.add(InMemoryGlucoseValue(value = 214.0, timestamp = 1514766900000, trendArrow = GlucoseValue.TrendArrow.FLAT))
- list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766800000, trendArrow = GlucoseValue.TrendArrow.FLAT))
- list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766600000, trendArrow = GlucoseValue.TrendArrow.FLAT))
- return list
- }
-*/
+ private fun generateMostRecentBgData(): MutableList {
+ val list: MutableList = ArrayList()
+ list.add(InMemoryGlucoseValue(value = 214.0, timestamp = 1514766900000, trendArrow = GlucoseValue.TrendArrow.FLAT))
+ list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766800000, trendArrow = GlucoseValue.TrendArrow.FLAT))
+ list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766600000, trendArrow = GlucoseValue.TrendArrow.FLAT))
+ return list
+ }
+ */
@Test fun oneRecordShouldProduceZeroDeltas() {
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOneCurrentRecordBgData())
val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData!!
- Assertions.assertEquals(214.0, glucoseStatus.glucose, 0.001)
- Assertions.assertEquals(0.0, glucoseStatus.delta, 0.001)
- Assertions.assertEquals(0.0, glucoseStatus.shortAvgDelta, 0.001) // -2 -2.5 -3 deltas are relative to current value
- Assertions.assertEquals(0.0, glucoseStatus.longAvgDelta, 0.001) // -2 -2 -2 -2
- Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date
+ assertThat(glucoseStatus.glucose).isWithin(0.001).of(214.0)
+ assertThat(glucoseStatus.delta).isWithin(0.001).of(0.0)
+ assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(0.0) // -2 -2.5 -3 deltas are relative to current value
+ assertThat(glucoseStatus.longAvgDelta).isWithin(0.001).of(0.0) // -2 -2 -2 -2
+ assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date
}
@Test fun insufficientDataShouldReturnNull() {
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateInsufficientBgData())
val glucoseStatus: GlucoseStatus? = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData
- Assertions.assertEquals(null, glucoseStatus)
+ assertThat(glucoseStatus).isNull()
}
@Test fun oldDataShouldReturnNull() {
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOldBgData())
val glucoseStatus: GlucoseStatus? = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData
- Assertions.assertEquals(null, glucoseStatus)
+ assertThat(glucoseStatus).isNull()
}
@Test fun returnOldDataIfAllowed() {
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOldBgData())
val glucoseStatus: GlucoseStatus? = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).getGlucoseStatusData(true)
- Assertions.assertNotEquals(null, glucoseStatus)
+ assertThat(glucoseStatus).isNull()
}
@Test fun averageShouldNotFailOnEmptyArray() {
- Assertions.assertEquals(0.0, GlucoseStatusProviderImpl.average(ArrayList()), 0.001)
+ assertThat(GlucoseStatusProviderImpl.average(ArrayList())).isWithin(0.001).of(0.0)
}
-/*
- Not testing anymore, not valid for bucketed data
+ /*
+ Not testing anymore, not valid for bucketed data
- @Test fun calculateGlucoseStatusForLibreTestBgData() {
- Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateLibreTestData())
- val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
- Assertions.assertEquals(100.0, glucoseStatus.glucose, 0.001) //
- Assertions.assertEquals(-10.0, glucoseStatus.delta, 0.001)
- Assertions.assertEquals(-10.0, glucoseStatus.shortAvgDelta, 0.001)
- Assertions.assertEquals(-10.0, glucoseStatus.longAvgDelta, 0.001)
- Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date
- }
+ @Test fun calculateGlucoseStatusForLibreTestBgData() {
+ Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateLibreTestData())
+ val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
+ assertThat(glucoseStatus.glucose).isWithin(0.001).of(100.0)
+ assertThat(glucoseStatus.delta).isWithin(0.001).of(-10.0)
+ assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(-10.0)
+ assertThat(glucoseStatus.longAvgDelta).isWithin(0.001).of(-10.0)
+ assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date
+ }
- private fun generateLibreTestData(): MutableList {
- val list: MutableList = ArrayList()
- val endTime = 1514766900000L
- val latestReading = 100.0
- // Now
- list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime, trendArrow = GlucoseValue.TrendArrow.FLAT))
- // One minute ago
- list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 1, trendArrow = GlucoseValue.TrendArrow.FLAT))
- // Two minutes ago
- list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 2, trendArrow = GlucoseValue.TrendArrow.FLAT))
- // Three minutes and beyond at constant rate
- for (i in 3..49)
- list.add(InMemoryGlucoseValue(value = latestReading + i * 2, timestamp = endTime - 1000 * 60 * i, trendArrow = GlucoseValue.TrendArrow.FLAT))
- return list
- }
-*/
+ private fun generateLibreTestData(): MutableList {
+ val list: MutableList = ArrayList()
+ val endTime = 1514766900000L
+ val latestReading = 100.0
+ // Now
+ list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime, trendArrow = GlucoseValue.TrendArrow.FLAT))
+ // One minute ago
+ list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 1, trendArrow = GlucoseValue.TrendArrow.FLAT))
+ // Two minutes ago
+ list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 2, trendArrow = GlucoseValue.TrendArrow.FLAT))
+ // Three minutes and beyond at constant rate
+ for (i in 3..49)
+ list.add(InMemoryGlucoseValue(value = latestReading + i * 2, timestamp = endTime - 1000 * 60 * i, trendArrow = GlucoseValue.TrendArrow.FLAT))
+ return list
+ }
+ */
@BeforeEach
fun initMocking() {
@@ -166,4 +166,4 @@ class GlucoseStatusTest : TestBaseWithProfile() {
list.add(InMemoryGlucoseValue(value = 214.0, timestamp = 1514766900000, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
return list
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/test/java/info/nightscout/implementation/overview/OverviewDataImplTest.kt b/implementation/src/test/java/info/nightscout/implementation/overview/OverviewDataImplTest.kt
index d0f483f2c9..4fce738688 100644
--- a/implementation/src/test/java/info/nightscout/implementation/overview/OverviewDataImplTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/overview/OverviewDataImplTest.kt
@@ -1,5 +1,6 @@
package info.nightscout.implementation.overview
+import com.google.common.truth.Truth.assertThat
import info.nightscout.database.ValueWrapper
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.database.impl.AppRepository
@@ -10,7 +11,6 @@ import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.shared.utils.T
import info.nightscout.sharedtests.TestBaseWithProfile
import io.reactivex.rxjava3.core.Single
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -43,23 +43,23 @@ class OverviewDataImplTest : TestBaseWithProfile() {
// no data
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Absent()))
- Assertions.assertNull(sut.lastBg(autosensDataStore))
- Assertions.assertFalse(sut.isLow(autosensDataStore))
- Assertions.assertFalse(sut.isHigh(autosensDataStore))
+ assertThat(sut.lastBg(autosensDataStore)).isNull()
+ assertThat(sut.isLow(autosensDataStore)).isFalse()
+ assertThat(sut.isHigh(autosensDataStore)).isFalse()
// no bucketed but in db
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Existing(glucoseValue)))
- Assertions.assertEquals(200.0, sut.lastBg(autosensDataStore)?.value)
- Assertions.assertFalse(sut.isLow(autosensDataStore))
- Assertions.assertTrue(sut.isHigh(autosensDataStore))
+ assertThat(sut.lastBg(autosensDataStore)?.value).isEqualTo(200.0)
+ assertThat(sut.isLow(autosensDataStore)).isFalse()
+ assertThat(sut.isHigh(autosensDataStore)).isTrue()
// in bucketed
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(bucketedData)
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Existing(glucoseValue)))
- Assertions.assertEquals(70.0, sut.lastBg(autosensDataStore)?.value)
- Assertions.assertTrue(sut.isLow(autosensDataStore))
- Assertions.assertFalse(sut.isHigh(autosensDataStore))
+ assertThat(sut.lastBg(autosensDataStore)?.value).isEqualTo(70.0)
+ assertThat(sut.isLow(autosensDataStore)).isTrue()
+ assertThat(sut.isHigh(autosensDataStore)).isFalse()
}
@Test
@@ -68,13 +68,13 @@ class OverviewDataImplTest : TestBaseWithProfile() {
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Existing(glucoseValue)))
Mockito.`when`(dateUtil.now()).thenReturn(time + T.mins(1).msecs())
- Assertions.assertTrue(sut.isActualBg(autosensDataStore))
+ assertThat(sut.isActualBg(autosensDataStore)).isTrue()
Mockito.`when`(dateUtil.now()).thenReturn(time + T.mins(9).msecs() + 1)
- Assertions.assertFalse(sut.isActualBg(autosensDataStore))
+ assertThat(sut.isActualBg(autosensDataStore)).isFalse()
// no data
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Absent()))
- Assertions.assertFalse(sut.isActualBg(autosensDataStore))
+ assertThat(sut.isActualBg(autosensDataStore)).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt b/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt
index 0f7eee5b5f..0c142e8ba7 100644
--- a/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt
@@ -1,47 +1,47 @@
package info.nightscout.implementation.profile
+import com.google.common.truth.Truth.assertThat
import info.nightscout.interfaces.profile.PureProfile
import info.nightscout.sharedtests.TestBaseWithProfile
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
internal class ProfileStoreTest : TestBaseWithProfile() {
@Test
fun getStartDateTest() {
- Assertions.assertEquals(0, getValidProfileStore().getStartDate())
+ assertThat(getValidProfileStore().getStartDate()).isEqualTo(0)
}
@Test
fun getDefaultProfileTest() {
- Assertions.assertTrue(getValidProfileStore().getDefaultProfile() is PureProfile)
+ assertThat(getValidProfileStore().getDefaultProfile()).isInstanceOf(PureProfile::class.java)
}
@Test
fun getDefaultProfileJsonTest() {
- Assertions.assertTrue(getValidProfileStore().getDefaultProfileJson()?.has("dia") ?: false)
- Assertions.assertEquals(null, getInvalidProfileStore2().getDefaultProfileJson())
+ assertThat(getValidProfileStore().getDefaultProfileJson()?.has("dia")).isTrue()
+ assertThat(getInvalidProfileStore2().getDefaultProfileJson()).isNull()
}
@Test
fun getDefaultProfileNameTest() {
- Assertions.assertEquals(TESTPROFILENAME, getValidProfileStore().getDefaultProfileName())
+ assertThat(getValidProfileStore().getDefaultProfileName()).isEqualTo(TESTPROFILENAME)
}
@Test
fun getProfileListTest() {
- Assertions.assertEquals(1, getValidProfileStore().getProfileList().size)
+ assertThat(getValidProfileStore().getProfileList()).hasSize(1)
}
@Test
fun getSpecificProfileTest() {
- Assertions.assertTrue(getValidProfileStore().getSpecificProfile(TESTPROFILENAME) is PureProfile)
+ assertThat(getValidProfileStore().getSpecificProfile(TESTPROFILENAME)).isInstanceOf(PureProfile::class.java)
}
@Test
fun allProfilesValidTest() {
- Assertions.assertTrue(getValidProfileStore().allProfilesValid)
- Assertions.assertFalse(getInvalidProfileStore1().allProfilesValid)
- Assertions.assertFalse(getInvalidProfileStore2().allProfilesValid)
+ assertThat(getValidProfileStore().allProfilesValid).isTrue()
+ assertThat(getInvalidProfileStore1().allProfilesValid).isFalse()
+ assertThat(getInvalidProfileStore2().allProfilesValid).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/test/java/info/nightscout/implementation/profile/ProfileUtilImplTest.kt b/implementation/src/test/java/info/nightscout/implementation/profile/ProfileUtilImplTest.kt
index b90f62884a..b9b02c1847 100644
--- a/implementation/src/test/java/info/nightscout/implementation/profile/ProfileUtilImplTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/profile/ProfileUtilImplTest.kt
@@ -1,12 +1,12 @@
package info.nightscout.implementation.profile
+import com.google.common.truth.Truth.assertThat
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.implementation.utils.DecimalFormatterImpl
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.sharedtests.TestBase
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -29,19 +29,19 @@ class ProfileUtilImplTest : TestBase() {
@Test
fun toUnitsString() {
- Assertions.assertEquals("100", sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MGDL))
- Assertions.assertEquals("5.6", sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MMOL))
- Assertions.assertEquals(0.1, sut.convertToMgdl(0.1, GlucoseUnit.MGDL), 0.01)
- Assertions.assertEquals(18.0, sut.convertToMgdl(1.0, GlucoseUnit.MMOL), 0.01)
- Assertions.assertEquals(1.0, sut.convertToMmol(18.0, GlucoseUnit.MGDL), 0.01)
- Assertions.assertEquals(18.0, sut.convertToMmol(18.0, GlucoseUnit.MMOL), 0.01)
- Assertions.assertEquals(18.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL), 0.01)
- Assertions.assertEquals(1.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL), 0.01)
- Assertions.assertEquals(18.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL), 0.01)
- Assertions.assertEquals(1.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL), 0.01)
- Assertions.assertEquals("18", sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MGDL))
- Assertions.assertEquals("1.0", sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MMOL).replace(",", "."))
- Assertions.assertEquals("5 - 6", sut.toTargetRangeString(5.0, 6.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL))
- Assertions.assertEquals("4", sut.toTargetRangeString(4.0, 4.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL))
+ assertThat(sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MGDL)).isEqualTo("100")
+ assertThat(sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MMOL)).isEqualTo("5.6")
+ assertThat(sut.convertToMgdl(0.1, GlucoseUnit.MGDL)).isWithin(0.01).of(0.1)
+ assertThat(sut.convertToMgdl(1.0, GlucoseUnit.MMOL)).isWithin(0.01).of(18.0)
+ assertThat(sut.convertToMmol(18.0, GlucoseUnit.MGDL)).isWithin(0.01).of(1.0)
+ assertThat(sut.convertToMmol(18.0, GlucoseUnit.MMOL)).isWithin(0.01).of(18.0)
+ assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL)).isWithin(0.01).of(18.0)
+ assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL)).isWithin(0.01).of(1.0)
+ assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL)).isWithin(0.01).of(18.0)
+ assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL)).isWithin(0.01).of(1.0)
+ assertThat(sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MGDL)).isEqualTo("18")
+ assertThat(sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MMOL).replace(",", ".")).isEqualTo("1.0")
+ assertThat(sut.toTargetRangeString(5.0, 6.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL)).isEqualTo("5 - 6")
+ assertThat(sut.toTargetRangeString(4.0, 4.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL)).isEqualTo("4")
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt b/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt
index 5f1e23593b..3de4e26a24 100644
--- a/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt
@@ -1,11 +1,11 @@
package info.nightscout.implementation.pump
+import com.google.common.truth.Truth.assertThat
import info.nightscout.implementation.R
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.sharedtests.TestBase
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -47,9 +47,9 @@ class DetailedBolusInfoStorageTest : TestBase() {
@Test
fun add() {
detailedBolusInfoStorage.store.clear()
- Assertions.assertEquals(0, detailedBolusInfoStorage.store.size)
+ assertThat(detailedBolusInfoStorage.store).isEmpty()
detailedBolusInfoStorage.add(info1)
- Assertions.assertEquals(1, detailedBolusInfoStorage.store.size)
+ assertThat(detailedBolusInfoStorage.store).hasSize(1)
}
@Test
@@ -58,38 +58,38 @@ class DetailedBolusInfoStorageTest : TestBase() {
// Look for exact bolus
setUp()
var d: DetailedBolusInfo? = detailedBolusInfoStorage.findDetailedBolusInfo(1000000, 4.0)
- Assertions.assertEquals(4.0, d!!.insulin, 0.01)
- Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
+ assertThat(d!!.insulin).isWithin(0.01).of(4.0)
+ assertThat(detailedBolusInfoStorage.store).hasSize(2)
// Look for exact bolus
setUp()
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000000, 3.0)
- Assertions.assertEquals(3.0, d!!.insulin, 0.01)
- Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
+ assertThat(d!!.insulin).isWithin(0.01).of(3.0)
+ assertThat(detailedBolusInfoStorage.store).hasSize(2)
// With less insulin (bolus not delivered completely). Should return first one matching date
setUp()
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000500, 2.0)
- Assertions.assertEquals(3.0, d!!.insulin, 0.01)
- Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
+ assertThat(d!!.insulin).isWithin(0.01).of(3.0)
+ assertThat(detailedBolusInfoStorage.store).hasSize(2)
// With less insulin (bolus not delivered completely). Should return first one matching date
setUp()
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000500, 3.5)
- Assertions.assertEquals(4.0, d!!.insulin, 0.01)
- Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
+ assertThat(d!!.insulin).isWithin(0.01).of(4.0)
+ assertThat(detailedBolusInfoStorage.store).hasSize(2)
// With more insulin should return null
setUp()
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000500, 4.5)
- Assertions.assertNull(d)
- Assertions.assertEquals(3, detailedBolusInfoStorage.store.size)
+ assertThat(d).isNull()
+ assertThat(detailedBolusInfoStorage.store).hasSize(3)
// With more than one minute off should return null
setUp()
d = detailedBolusInfoStorage.findDetailedBolusInfo(1070000, 4.0)
- Assertions.assertNull(d)
- Assertions.assertEquals(3, detailedBolusInfoStorage.store.size)
+ assertThat(d).isNull()
+ assertThat(detailedBolusInfoStorage.store).hasSize(3)
// Use last, if bolus size is the same
// setUp()
// d = detailedBolusInfoStorage.findDetailedBolusInfo(1070000, 5.0)
-// assertEquals(5.0, d!!.insulin, 0.01)
-// assertEquals(2, detailedBolusInfoStorage.store.size)
+// assertThat( d!!.insulin).isWithin(0.01).of(5.0)
+// assertThat(detailedBolusInfoStorage.store).hasSize(2)
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt b/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt
index 14465bf0f4..881bd46aa9 100644
--- a/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt
@@ -1,8 +1,8 @@
package info.nightscout.implementation.pump
+import com.google.common.truth.Truth.assertThat
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.sharedtests.TestBase
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
@@ -29,9 +29,9 @@ class TemporaryBasalStorageTest : TestBase() {
@Test
fun add() {
temporaryBasalStorage.store.clear()
- Assertions.assertEquals(0, temporaryBasalStorage.store.size)
+ assertThat(temporaryBasalStorage.store).isEmpty()
temporaryBasalStorage.add(info1)
- Assertions.assertEquals(1, temporaryBasalStorage.store.size)
+ assertThat(temporaryBasalStorage.store).hasSize(1)
}
@Test
@@ -40,38 +40,38 @@ class TemporaryBasalStorageTest : TestBase() {
// Look for exact bolus
setUp()
var d = temporaryBasalStorage.findTemporaryBasal(1000000, 4.0)
- Assertions.assertEquals(4.0, d!!.rate, 0.01)
- Assertions.assertEquals(2, temporaryBasalStorage.store.size)
+ assertThat(d!!.rate).isWithin(0.01).of(4.0)
+ assertThat(temporaryBasalStorage.store).hasSize(2)
// Look for exact bolus
setUp()
d = temporaryBasalStorage.findTemporaryBasal(1000000, 3.0)
- Assertions.assertEquals(3.0, d!!.rate, 0.01)
- Assertions.assertEquals(2, temporaryBasalStorage.store.size)
+ assertThat(d!!.rate).isWithin(0.01).of(3.0)
+ assertThat(temporaryBasalStorage.store).hasSize(2)
// With less rate (bolus not delivered completely). Should return first one matching date
setUp()
d = temporaryBasalStorage.findTemporaryBasal(1000500, 2.0)
- Assertions.assertEquals(3.0, d!!.rate, 0.01)
- Assertions.assertEquals(2, temporaryBasalStorage.store.size)
+ assertThat(d!!.rate).isWithin(0.01).of(3.0)
+ assertThat(temporaryBasalStorage.store).hasSize(2)
// With less rate (bolus not delivered completely). Should return first one matching date
setUp()
d = temporaryBasalStorage.findTemporaryBasal(1000500, 3.5)
- Assertions.assertEquals(4.0, d!!.rate, 0.01)
- Assertions.assertEquals(2, temporaryBasalStorage.store.size)
+ assertThat(d!!.rate).isWithin(0.01).of(4.0)
+ assertThat(temporaryBasalStorage.store).hasSize(2)
// With more rate should return null
setUp()
d = temporaryBasalStorage.findTemporaryBasal(1000500, 4.5)
- Assertions.assertNull(d)
- Assertions.assertEquals(3, temporaryBasalStorage.store.size)
+ assertThat(d).isNull()
+ assertThat(temporaryBasalStorage.store).hasSize(3)
// With more than one minute off should return null
setUp()
d = temporaryBasalStorage.findTemporaryBasal(1070000, 4.0)
- Assertions.assertNull(d)
- Assertions.assertEquals(3, temporaryBasalStorage.store.size)
+ assertThat(d).isNull()
+ assertThat(temporaryBasalStorage.store).hasSize(3)
// Use last, if bolus size is the same
setUp()
d = temporaryBasalStorage.findTemporaryBasal(1070000, 5.0)
- Assertions.assertEquals(5.0, d!!.rate, 0.01)
- Assertions.assertEquals(2, temporaryBasalStorage.store.size)
+ assertThat(d!!.rate).isWithin(0.01).of(5.0)
+ assertThat(temporaryBasalStorage.store).hasSize(2)
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt
index f77ea1b704..1d5f831bfe 100644
--- a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt
@@ -1,5 +1,6 @@
package info.nightscout.implementation.queue
+import com.google.common.truth.Truth.assertThat
import android.content.Context
import android.os.Handler
import android.os.PowerManager
@@ -38,7 +39,6 @@ import info.nightscout.shared.utils.DateUtil
import info.nightscout.sharedtests.TestBaseWithProfile
import info.nightscout.sharedtests.TestPumpPlugin
import io.reactivex.rxjava3.core.Single
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -169,121 +169,121 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
commandQueue.handler = handler
// start with empty queue
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// add bolus command
commandQueue.bolus(DetailedBolusInfo(), null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
commandQueue.waitForFinishedThread()
Thread.sleep(1000)
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
}
@Test
fun doTests() {
// start with empty queue
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// add bolus command
commandQueue.bolus(DetailedBolusInfo(), null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
// add READSTATUS
commandQueue.readStatus("anyString", null)
- Assertions.assertEquals(2, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(2)
// adding another bolus should remove the first one (size still == 2)
commandQueue.bolus(DetailedBolusInfo(), null)
- Assertions.assertEquals(2, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(2)
// clear the queue should reset size
commandQueue.clear()
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// add tempbasal
commandQueue.tempBasalAbsolute(0.0, 30, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
// add tempbasal percent. it should replace previous TEMPBASAL
commandQueue.tempBasalPercent(0, 30, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
// cancel tempbasal it should replace previous TEMPBASAL
commandQueue.cancelTempBasal(false, null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
// add extended bolus
commandQueue.extendedBolus(1.0, 30, null)
- Assertions.assertEquals(2, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(2)
// add extended should remove previous extended setting
commandQueue.extendedBolus(1.0, 30, null)
- Assertions.assertEquals(2, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(2)
// cancel extended bolus should replace previous extended
commandQueue.cancelExtended(null)
- Assertions.assertEquals(2, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(2)
// add setProfile
// TODO: this crash the test
// commandQueue.setProfile(validProfile, null)
- // Assertions.assertEquals(3, commandQueue.size())
+ // assertThat(commandQueue.size()).isEqualTo(3)
// add loadHistory
commandQueue.loadHistory(0.toByte(), null)
- Assertions.assertEquals(3, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(3)
// add loadEvents
commandQueue.loadEvents(null)
- Assertions.assertEquals(4, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(4)
// add clearAlarms
commandQueue.clearAlarms(null)
- Assertions.assertEquals(5, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(5)
// add deactivate
commandQueue.deactivate(null)
- Assertions.assertEquals(6, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(6)
// add updateTime
commandQueue.updateTime(null)
- Assertions.assertEquals(7, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(7)
commandQueue.clear()
commandQueue.tempBasalAbsolute(0.0, 30, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
commandQueue.pickup()
- Assertions.assertEquals(0, commandQueue.size())
- Assertions.assertNotNull(commandQueue.performing)
- Assertions.assertEquals(Command.CommandType.TEMPBASAL, commandQueue.performing?.commandType)
+ assertThat(commandQueue.size()).isEqualTo(0)
+ assertThat(commandQueue.performing).isNotNull()
+ assertThat(commandQueue.performing?.commandType).isEqualTo(Command.CommandType.TEMPBASAL)
commandQueue.resetPerforming()
- Assertions.assertNull(commandQueue.performing)
+ assertThat(commandQueue.performing).isNull()
}
@Test
fun callingCancelAllBolusesClearsQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
val smb = DetailedBolusInfo()
smb.lastKnownBolusTime = System.currentTimeMillis()
smb.bolusType = DetailedBolusInfo.BolusType.SMB
commandQueue.bolus(smb, null)
commandQueue.bolus(DetailedBolusInfo(), null)
- Assertions.assertEquals(2, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(2)
// when
commandQueue.cancelAllBoluses(null)
// then
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
}
@Test
fun smbIsRejectedIfABolusIsQueued() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.bolus(DetailedBolusInfo(), null)
@@ -292,14 +292,14 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
val queued: Boolean = commandQueue.bolus(smb, null)
// then
- Assertions.assertFalse(queued)
- Assertions.assertEquals(commandQueue.size(), 1)
+ assertThat(queued).isFalse()
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun smbIsRejectedIfLastKnownBolusIsOutdated() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
val bolus = DetailedBolusInfo()
@@ -308,14 +308,14 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
val queued: Boolean = commandQueue.bolus(bolus, null)
// then
- Assertions.assertFalse(queued)
- Assertions.assertEquals(commandQueue.size(), 0)
+ assertThat(queued).isFalse()
+ assertThat(commandQueue.size()).isEqualTo(0)
}
@Test
fun isCustomCommandRunning() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
val queued1 = commandQueue.customCommand(CustomCommand1(), null)
@@ -323,249 +323,249 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
commandQueue.pickup()
// then
- Assertions.assertTrue(queued1)
- Assertions.assertTrue(queued2)
- Assertions.assertTrue(commandQueue.isCustomCommandInQueue(CustomCommand1::class.java))
- Assertions.assertTrue(commandQueue.isCustomCommandInQueue(CustomCommand2::class.java))
- Assertions.assertFalse(commandQueue.isCustomCommandInQueue(CustomCommand3::class.java))
+ assertThat(queued1).isTrue()
+ assertThat(queued2).isTrue()
+ assertThat(commandQueue.isCustomCommandInQueue(CustomCommand1::class.java)).isTrue()
+ assertThat(commandQueue.isCustomCommandInQueue(CustomCommand2::class.java)).isTrue()
+ assertThat(commandQueue.isCustomCommandInQueue(CustomCommand3::class.java)).isFalse()
- Assertions.assertTrue(commandQueue.isCustomCommandRunning(CustomCommand1::class.java))
- Assertions.assertFalse(commandQueue.isCustomCommandRunning(CustomCommand2::class.java))
- Assertions.assertFalse(commandQueue.isCustomCommandRunning(CustomCommand3::class.java))
+ assertThat(commandQueue.isCustomCommandRunning(CustomCommand1::class.java)).isTrue()
+ assertThat(commandQueue.isCustomCommandRunning(CustomCommand2::class.java)).isFalse()
+ assertThat(commandQueue.isCustomCommandRunning(CustomCommand3::class.java)).isFalse()
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isSetUserOptionsCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.setUserOptions(null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.SET_USER_SETTINGS))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.SET_USER_SETTINGS)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.setUserOptions(null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isLoadEventsCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.loadEvents(null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.LOAD_EVENTS))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.LOAD_EVENTS)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.loadEvents(null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isClearAlarmsCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.clearAlarms(null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.CLEAR_ALARMS))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.CLEAR_ALARMS)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.clearAlarms(null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isDeactivateCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.deactivate(null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.DEACTIVATE))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.DEACTIVATE)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.deactivate(null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isUpdateTimeCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.updateTime(null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.UPDATE_TIME))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.UPDATE_TIME)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.updateTime(null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isLoadTDDsCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.loadTDDs(null)
// then
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.loadTDDs(null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isLoadHistoryCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.loadHistory(0, null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.LOAD_HISTORY))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.LOAD_HISTORY)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.loadHistory(0, null)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isProfileSetCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
testPumpPlugin.isProfileSet = true
commandQueue.setProfile(validProfile, false, object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
- Assertions.assertFalse(result.enacted)
+ assertThat(result.success).isTrue()
+ assertThat(result.enacted).isFalse()
}
})
// then
// the same profile -> ignore
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// different should be added
testPumpPlugin.isProfileSet = false
commandQueue.setProfile(validProfile, false, object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
- Assertions.assertTrue(result.enacted)
+ assertThat(result.success).isTrue()
+ assertThat(result.enacted).isTrue()
}
})
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
// next should be ignored
commandQueue.setProfile(validProfile, false, object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(1)
testPumpPlugin.isProfileSet = true
}
@Test
fun isStopCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.stopPump(null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.STOP_PUMP))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.STOP_PUMP)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isStarCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.startPump(null)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.START_PUMP))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.START_PUMP)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun isSetTbrNotificationCommandInQueue() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
commandQueue.setTBROverNotification(null, true)
// then
- Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.INSIGHT_SET_TBR_OVER_ALARM))
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(commandQueue.isLastScheduled(Command.CommandType.INSIGHT_SET_TBR_OVER_ALARM)).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun differentCustomCommandsAllowed() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
val queued1 = commandQueue.customCommand(CustomCommand1(), null)
val queued2 = commandQueue.customCommand(CustomCommand2(), null)
// then
- Assertions.assertTrue(queued1)
- Assertions.assertTrue(queued2)
- Assertions.assertEquals(2, commandQueue.size())
+ assertThat(queued1).isTrue()
+ assertThat(queued2).isTrue()
+ assertThat(commandQueue.size()).isEqualTo(2)
}
@Test
fun sameCustomCommandNotAllowed() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
val queued1 = commandQueue.customCommand(CustomCommand1(), null)
val queued2 = commandQueue.customCommand(CustomCommand1(), null)
// then
- Assertions.assertTrue(queued1)
- Assertions.assertFalse(queued2)
- Assertions.assertEquals(1, commandQueue.size())
+ assertThat(queued1).isTrue()
+ assertThat(queued2).isFalse()
+ assertThat(commandQueue.size()).isEqualTo(1)
}
@Test
fun readStatusTwiceIsNotAllowed() {
// given
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
// when
val queued1 = commandQueue.readStatus("1", null)
val queued2 = commandQueue.readStatus("2", null)
// then
- Assertions.assertTrue(queued1)
- Assertions.assertFalse(queued2)
- Assertions.assertEquals(1, commandQueue.size())
- Assertions.assertTrue(commandQueue.statusInQueue())
+ assertThat(queued1).isTrue()
+ assertThat(queued2).isFalse()
+ assertThat(commandQueue.size()).isEqualTo(1)
+ assertThat(commandQueue.statusInQueue()).isTrue()
}
private class CustomCommand1 : CustomCommand {
diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt
index f8e3494ac5..d0d131d27f 100644
--- a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt
@@ -1,5 +1,6 @@
package info.nightscout.implementation.queue
+import com.google.common.truth.Truth.assertThat
import android.content.Context
import android.os.PowerManager
import dagger.android.AndroidInjector
@@ -16,7 +17,6 @@ import info.nightscout.interfaces.queue.Command
import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.sharedtests.TestBaseWithProfile
import info.nightscout.sharedtests.TestPumpPlugin
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
@@ -84,6 +84,6 @@ class QueueThreadTest : TestBaseWithProfile() {
commandQueue.tempBasalAbsolute(2.0, 60, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
@Suppress("CallToThreadRun")
sut.run()
- Assertions.assertEquals(0, commandQueue.size())
+ assertThat(commandQueue.size()).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/test/java/info/nightscout/implementation/utils/DecimalFormatterTest.kt b/implementation/src/test/java/info/nightscout/implementation/utils/DecimalFormatterTest.kt
index 9ab168ff5b..2b5938656c 100644
--- a/implementation/src/test/java/info/nightscout/implementation/utils/DecimalFormatterTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/utils/DecimalFormatterTest.kt
@@ -1,9 +1,9 @@
package info.nightscout.implementation.utils
+import com.google.common.truth.Truth.assertThat
import info.nightscout.interfaces.utils.DecimalFormatter
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.sharedtests.TestBase
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -20,22 +20,22 @@ class DecimalFormatterTest : TestBase() {
}
@Test fun to0DecimalTest() {
- Assertions.assertEquals("1", sut.to0Decimal(1.33).replace(",", "."))
- Assertions.assertEquals("1U", sut.to0Decimal(1.33, "U").replace(",", "."))
+ assertThat(sut.to0Decimal(1.33).replace(",", ".")).isEqualTo("1")
+ assertThat(sut.to0Decimal(1.33, "U").replace(",", ".")).isEqualTo("1U")
}
@Test fun to1DecimalTest() {
- Assertions.assertEquals("1.3", sut.to1Decimal(1.33).replace(",", "."))
- Assertions.assertEquals("1.3U", sut.to1Decimal(1.33, "U").replace(",", "."))
+ assertThat(sut.to1Decimal(1.33).replace(",", ".")).isEqualTo("1.3")
+ assertThat(sut.to1Decimal(1.33, "U").replace(",", ".")).isEqualTo("1.3U")
}
@Test fun to2DecimalTest() {
- Assertions.assertEquals("1.33", sut.to2Decimal(1.3333).replace(",", "."))
- Assertions.assertEquals("1.33U", sut.to2Decimal(1.3333, "U").replace(",", "."))
+ assertThat(sut.to2Decimal(1.3333).replace(",", ".")).isEqualTo("1.33")
+ assertThat(sut.to2Decimal(1.3333, "U").replace(",", ".")).isEqualTo("1.33U")
}
@Test fun to3DecimalTest() {
- Assertions.assertEquals("1.333", sut.to3Decimal(1.3333).replace(",", "."))
- Assertions.assertEquals("1.333U", sut.to3Decimal(1.3333, "U").replace(",", "."))
+ assertThat(sut.to3Decimal(1.3333).replace(",", ".")).isEqualTo("1.333")
+ assertThat(sut.to3Decimal(1.3333, "U").replace(",", ".")).isEqualTo("1.333U")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/aps/src/main/res/values-fr-rFR/strings.xml b/plugins/aps/src/main/res/values-fr-rFR/strings.xml
index 14ee2eb279..ee7aa8d99d 100644
--- a/plugins/aps/src/main/res/values-fr-rFR/strings.xml
+++ b/plugins/aps/src/main/res/values-fr-rFR/strings.xml
@@ -114,4 +114,5 @@
SMB défini par la pompe
Changement minimum [%]
Le fonctionnement de la Boucle demandera une confirmation uniquement si le changement est supérieur à cette valeur en %. Par défaut, la valeur est 20%
+ Revenir à SMB. Pas assez de données DTQ.
diff --git a/plugins/configuration/src/main/res/values-es-rES/strings.xml b/plugins/configuration/src/main/res/values-es-rES/strings.xml
index e0b4bc3fe2..50085130c9 100644
--- a/plugins/configuration/src/main/res/values-es-rES/strings.xml
+++ b/plugins/configuration/src/main/res/values-es-rES/strings.xml
@@ -68,8 +68,8 @@
Sincronización
Subida de datos y sincronización de plugins
¿Qué restricciones se aplican?
- Lazo
- Usa esto para habilitar la integración de lazo de AAPS
+ Bucle
+ Usa esto para habilitar la integración de bucle de AAPS.
¿Qué tipo de insulina estás utilizando?
Origen de Glucosa
¿Desde dónde debería obtener AAPS los datos?
diff --git a/plugins/configuration/src/main/res/values-fr-rFR/strings.xml b/plugins/configuration/src/main/res/values-fr-rFR/strings.xml
index a8a9347e91..bc44096eba 100644
--- a/plugins/configuration/src/main/res/values-fr-rFR/strings.xml
+++ b/plugins/configuration/src/main/res/values-fr-rFR/strings.xml
@@ -158,4 +158,14 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Veuillez redémarrer votre téléphone ou redémarrer AAPS à partir des Paramètres du système\nsinon AAPS ne sera pas connecté aux journaux (important pour suivre et vérifier que les algorithmes fonctionnent correctement)!
+ Format de fichier
+ Créé le
+ Version d\'AAPS
+ Version de construction
+ Export du nom du patient de l\'appareil
+ Export du modèle de l\'appareil
+ Cryptage du fichier
+ Nouveau format chiffré
+ Nouveau format de débogage (non crypté)
+ Format d\'export inconnu
diff --git a/plugins/configuration/src/main/res/values-nl-rNL/strings.xml b/plugins/configuration/src/main/res/values-nl-rNL/strings.xml
index 18069e6dbd..6ec2b6d60b 100644
--- a/plugins/configuration/src/main/res/values-nl-rNL/strings.xml
+++ b/plugins/configuration/src/main/res/values-nl-rNL/strings.xml
@@ -157,4 +157,14 @@
Herstart je telefoon of herstart AndroidAPS vanuit de systeem instellingen a. u. b. \nanders zal AndroidAPS geen log mogelijkheid hebben (Dit is belangrijk om te controleren of de algoritmes correct werken)!
+ Bestandsformaat
+ Gemaakt op
+ AAPS versie
+ Build variant
+ Patiëntnaam van exporterend apparaat
+ Modelnaam/nr van exporterend apparaat
+ Bestandsversleuteling
+ Nieuwe versleutelde indeling
+ Nieuwe debug indeling (onversleuteld)
+ Onbekende export indeling
diff --git a/plugins/configuration/src/main/res/values-no-rNO/strings.xml b/plugins/configuration/src/main/res/values-no-rNO/strings.xml
index cd97d79a15..c99a9a9e89 100644
--- a/plugins/configuration/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/configuration/src/main/res/values-no-rNO/strings.xml
@@ -157,4 +157,14 @@
Vennligst start mobilen på nytt eller restart AAPS fra Innstillinger \nellers vil ikke AAPS ha aktivert loggføring (viktig for å spore og kontrollere at algoritmene fungerer riktig)!
+ Filformat
+ Opprettet den
+ AAPS versjon
+ Byggvariant
+ Exporterer enhetens pasientnavn
+ Eksporterer enhetsmodell
+ Filkryptering
+ Nytt krypteringsformat
+ Nytt feilsøkingsformat (ukryptert)
+ Ukjent eksportformat
diff --git a/plugins/constraints/src/main/res/values-es-rES/exam.xml b/plugins/constraints/src/main/res/values-es-rES/exam.xml
index f952d8d050..175feca353 100644
--- a/plugins/constraints/src/main/res/values-es-rES/exam.xml
+++ b/plugins/constraints/src/main/res/values-es-rES/exam.xml
@@ -5,7 +5,7 @@
Debes establecer el valor de DAI en tu perfil.
El valor mínimo permitido es de 5 horas.
https://wiki.aaps.app/en/latest/Configuration/Config-Builder.html#insulin
- Si usted está satisfecho de que el valor para DIA que utilizó en su bomba antes de que AAPS funcionara bien, no hay necesidad de cambiar esto cuando comience a hacer bucle.
+ Si usted está satisfecho de que el valor para DIA que utilizó en su bomba antes de que AAPS funcionara bien, no hay necesidad de cambiar esto cuando comience usar el bucle cerrado.
Deberás determinar por ti mismo el valor apropiado para DAI.
Objetivo temporal ante Hipoglucemia
¿Cuál es la razón principal para establecer un objetivo temporal por hipoglucemia?
diff --git a/pump/pump-common/src/main/res/values-es-rES/strings.xml b/pump/pump-common/src/main/res/values-es-rES/strings.xml
index 48e4165e88..80098f60a9 100644
--- a/pump/pump-common/src/main/res/values-es-rES/strings.xml
+++ b/pump/pump-common/src/main/res/values-es-rES/strings.xml
@@ -65,7 +65,7 @@
Tipo:
- Nunca contactado
+ Nunca conectado
En reposo
Iniciando
Activo
diff --git a/pump/pump-common/src/main/res/values-fr-rFR/strings.xml b/pump/pump-common/src/main/res/values-fr-rFR/strings.xml
index deb828161f..5d642a102c 100644
--- a/pump/pump-common/src/main/res/values-fr-rFR/strings.xml
+++ b/pump/pump-common/src/main/res/values-fr-rFR/strings.xml
@@ -65,6 +65,14 @@
Type :
+ Jamais contacté
+ En veille
+ Réveil en cours
+ Actif
+ Erreur de communication
+ Délai de communication dépassé
+ Pompe hors de portée
+ Configuration invalide
- %1$d jour
- %1$d jours
diff --git a/pump/pump-common/src/main/res/values-nl-rNL/strings.xml b/pump/pump-common/src/main/res/values-nl-rNL/strings.xml
index 3a2d78f80b..9de4e465b0 100644
--- a/pump/pump-common/src/main/res/values-nl-rNL/strings.xml
+++ b/pump/pump-common/src/main/res/values-nl-rNL/strings.xml
@@ -65,6 +65,14 @@
Type:
+ Nooit verbonden
+ Slapend
+ Actief worden
+ Actief
+ Communicatiefout
+ Time-out bij communicatie
+ Pomp niet bereikbaar
+ Ongeldige configuratie
- %1$d dag
- %1$d dagen
diff --git a/pump/pump-common/src/main/res/values-no-rNO/strings.xml b/pump/pump-common/src/main/res/values-no-rNO/strings.xml
index c2a4ef0588..8d2febd014 100644
--- a/pump/pump-common/src/main/res/values-no-rNO/strings.xml
+++ b/pump/pump-common/src/main/res/values-no-rNO/strings.xml
@@ -65,6 +65,14 @@
Type:
+ Aldri tilkoblet
+ Hvilemodus
+ Våkner opp
+ Aktiv
+ Feil med kommunikasjon
+ Tidsavbrudd ved kommunikasjon
+ Pumpe er utilgjengelig
+ Ugyldig konfigurasjon
- %1$d dag
- %1$d dager
diff --git a/pump/pump-common/src/main/res/values-sk-rSK/strings.xml b/pump/pump-common/src/main/res/values-sk-rSK/strings.xml
index 2b24393489..0049960a42 100644
--- a/pump/pump-common/src/main/res/values-sk-rSK/strings.xml
+++ b/pump/pump-common/src/main/res/values-sk-rSK/strings.xml
@@ -65,6 +65,14 @@
Typ:
+ Nikdy nepripojené
+ Spiaca
+ Prebúdzanie
+ Aktívna
+ Chyba komunikácie
+ Uplynul časový limit komunikácie
+ Pumpa nedostupná
+ Neplatná konfigurácia
- %1$d deň
- %1$d dní
diff --git a/pump/virtual/src/main/res/values-fr-rFR/strings.xml b/pump/virtual/src/main/res/values-fr-rFR/strings.xml
index 5aea7cdfd9..f1df244f2f 100644
--- a/pump/virtual/src/main/res/values-fr-rFR/strings.xml
+++ b/pump/virtual/src/main/res/values-fr-rFR/strings.xml
@@ -9,4 +9,5 @@
POMPE VIRTUELLE
Paramètres pompe virtuelle
+ * Uniquement les valeurs unitaires sont acceptées. Les plages pour les basal/bolus ne sont pas supportées par les pompes virtuelles.
diff --git a/pump/virtual/src/main/res/values-nl-rNL/strings.xml b/pump/virtual/src/main/res/values-nl-rNL/strings.xml
index 14b441280d..15440c7b38 100644
--- a/pump/virtual/src/main/res/values-nl-rNL/strings.xml
+++ b/pump/virtual/src/main/res/values-nl-rNL/strings.xml
@@ -9,4 +9,5 @@
VIRTUELE POMP
Virtuele pomp instellingen
+ * Alleen absolute waardes (geen van-tot bereik) worden ondersteund voor basaal / bolus in virtuele pomp.
diff --git a/pump/virtual/src/main/res/values-no-rNO/strings.xml b/pump/virtual/src/main/res/values-no-rNO/strings.xml
index 5b349041ed..2f54e3efc2 100644
--- a/pump/virtual/src/main/res/values-no-rNO/strings.xml
+++ b/pump/virtual/src/main/res/values-no-rNO/strings.xml
@@ -9,4 +9,5 @@
VIRTUELL PUMPE
Innstillinger for virtuell pumpe
+ * Bare konkrete verdier støttes som granularitet for basal/bolus i virtuell pumpe, ingen verdiområder.
diff --git a/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt b/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt
index 3d7a4e8de8..028f3c2f7b 100644
--- a/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt
+++ b/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt
@@ -1,9 +1,9 @@
package info.nightscout.ui.defaultProfile
+import com.google.common.truth.Truth.assertThat
import info.nightscout.core.profile.ProfileSealed
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.sharedtests.TestBaseWithProfile
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class DefaultProfileTest : TestBaseWithProfile() {
@@ -12,18 +12,18 @@ class DefaultProfileTest : TestBaseWithProfile() {
fun profile() {
val dp = DefaultProfile(dateUtil, profileUtil).profile(5, 5.1 / 0.3, 0.0, GlucoseUnit.MMOL)
var p = ProfileSealed.Pure(dp!!)
- Assertions.assertEquals(0.150, p.getBasalTimeFromMidnight(0), 0.001)
- Assertions.assertEquals(15.0, p.getIcTimeFromMidnight(0), 0.001)
- Assertions.assertEquals(11.8, p.getIsfTimeFromMidnight(0), 0.001)
+ assertThat(p.getBasalTimeFromMidnight(0)).isWithin(0.001).of(0.150)
+ assertThat(p.getIcTimeFromMidnight(0)).isWithin(0.001).of(15.0)
+ assertThat(p.getIsfTimeFromMidnight(0)).isWithin(0.001).of(11.8)
p = ProfileSealed.Pure(DefaultProfile(dateUtil, profileUtil).profile(7, 10.0 / 0.4, 0.0, GlucoseUnit.MMOL)!!)
- Assertions.assertEquals(0.350, p.getBasalTimeFromMidnight(0), 0.001)
- Assertions.assertEquals(15.0, p.getIcTimeFromMidnight(0), 0.001)
- Assertions.assertEquals(6.8, p.getIsfTimeFromMidnight(0), 0.001)
+ assertThat(p.getBasalTimeFromMidnight(0)).isWithin(0.001).of(0.350)
+ assertThat(p.getIcTimeFromMidnight(0)).isWithin(0.001).of(15.0)
+ assertThat(p.getIsfTimeFromMidnight(0)).isWithin(0.001).of(6.8)
p = ProfileSealed.Pure(DefaultProfile(dateUtil, profileUtil).profile(12, 25.0 / 0.5, 0.0, GlucoseUnit.MMOL)!!)
- Assertions.assertEquals(0.80, p.getBasalTimeFromMidnight(0), 0.001)
- Assertions.assertEquals(10.0, p.getIcTimeFromMidnight(0), 0.001)
- Assertions.assertEquals(2.2, p.getIsfTimeFromMidnight(0), 0.001)
+ assertThat(p.getBasalTimeFromMidnight(0)).isWithin(0.001).of(0.80)
+ assertThat(p.getIcTimeFromMidnight(0)).isWithin(0.001).of(10.0)
+ assertThat(p.getIsfTimeFromMidnight(0)).isWithin(0.001).of(2.2)
}
-}
\ No newline at end of file
+}