Skip to content

Commit

Permalink
shared-tests #8
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosKozak committed Sep 3, 2023
1 parent 3477fcb commit 1cd93cd
Show file tree
Hide file tree
Showing 83 changed files with 277 additions and 889 deletions.
3 changes: 2 additions & 1 deletion pump/combo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ dependencies {
implementation project(':core:utils')
implementation project(':app-wear-shared:shared')

testImplementation project(':app-wear-shared:shared-tests')

// RuffyScripter
api "com.google.guava:guava:$guava_version"

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package info.nightscout.pump.combo
import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.profile.ProfileFunction
Expand All @@ -17,7 +16,8 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil
import org.junit.Assert
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
Expand Down Expand Up @@ -58,8 +58,8 @@ class ComboPluginTest : TestBase() {
comboPlugin.setValidBasalRateProfileSelectedOnPump(false)
var c = Constraint(true)
c = comboPlugin.isLoopInvocationAllowed(c)
Assert.assertEquals("Combo: No valid basal rate read from pump", c.getReasons(aapsLogger))
Assert.assertEquals(false, c.value())
Assertions.assertEquals("Combo: No valid basal rate read from pump", c.getReasons(aapsLogger))
Assertions.assertEquals(false, c.value())
comboPlugin.setPluginEnabled(PluginType.PUMP, false)
}

Expand All @@ -68,18 +68,18 @@ class ComboPluginTest : TestBase() {
val now = System.currentTimeMillis()
val pumpTimestamp = now - now % 1000
// same timestamp, different bolus leads to different fake timestamp
Assert.assertNotEquals(
Assertions.assertNotEquals(
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.1, true)),
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true))
)
// different timestamp, same bolus leads to different fake timestamp
Assert.assertNotEquals(
Assertions.assertNotEquals(
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true)),
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp + 60 * 1000, 0.3, true))
)
// generated timestamp has second-precision
val bolus = Bolus(pumpTimestamp, 0.2, true)
val calculatedTimestamp = comboPlugin.generatePumpBolusId(bolus)
Assert.assertEquals(calculatedTimestamp, calculatedTimestamp - calculatedTimestamp % 1000)
Assertions.assertEquals(calculatedTimestamp, calculatedTimestamp - calculatedTimestamp % 1000)
}
}
38 changes: 0 additions & 38 deletions pump/combo/src/test/java/info/nightscout/pump/combo/TestBase.kt

This file was deleted.

1 change: 1 addition & 0 deletions pump/dana/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ dependencies {
api "androidx.room:room-rxjava3:$room_version"
kapt "androidx.room:room-compiler:$room_version"

testImplementation project(':app-wear-shared:shared-tests')
testImplementation project(':core:main') // create profile from json
}

This file was deleted.

37 changes: 0 additions & 37 deletions pump/dana/src/test/java/info/nightscout/androidaps/TestBase.kt

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package info.nightscout.androidaps.dana
package info.nightscout.pump.dana

import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.interfaces.profile.Instantiator
import info.nightscout.pump.dana.DanaPump
import info.nightscout.shared.sharedPreferences.SP
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

class DanaPumpTest : TestBaseWithProfile() {

@Mock lateinit var sp: SP
@Mock lateinit var instantiator: Instantiator

private lateinit var sut: DanaPump
Expand Down
2 changes: 2 additions & 0 deletions pump/danar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ android {
}

dependencies {
implementation 'androidx.media3:media3-common:1.1.1'
implementation project(':app-wear-shared:shared')
implementation project(':core:interfaces')
implementation project(':core:utils')
implementation project(':core:ui')
implementation project(':core:validators')
implementation project(':pump:dana')

testImplementation project(':app-wear-shared:shared-tests')
testImplementation project(':core:main')
}
Loading

0 comments on commit 1cd93cd

Please sign in to comment.