-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b04b66
commit 05125af
Showing
7 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package info.nightscout.androidaps.plugins.insulin | ||
|
||
import dagger.android.HasAndroidInjector | ||
import info.nightscout.androidaps.R | ||
import info.nightscout.androidaps.interfaces.InsulinInterface | ||
import info.nightscout.androidaps.logging.AAPSLogger | ||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper | ||
import info.nightscout.androidaps.interfaces.ProfileFunction | ||
import info.nightscout.androidaps.utils.resources.ResourceHelper | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class InsulinLyumjevPlugin @Inject constructor( | ||
injector: HasAndroidInjector, | ||
resourceHelper: ResourceHelper, | ||
profileFunction: ProfileFunction, | ||
rxBus: RxBusWrapper, aapsLogger: AAPSLogger | ||
) : InsulinOrefBasePlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) { | ||
|
||
|
||
override fun getId(): Int = InsulinInterface.OREF_LYUMJEV | ||
|
||
override fun getFriendlyName(): String = resourceHelper.gs(R.string.lyumjev) | ||
|
||
override fun commentStandardText(): String = resourceHelper.gs(R.string.lyumjev) | ||
|
||
override val peak = 45 | ||
|
||
init { | ||
pluginDescription | ||
.pluginName(R.string.lyumjev) | ||
.description(R.string.description_insulin_lyumjev) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package info.nightscout.androidaps.plugins.insulin | ||
|
||
import dagger.android.AndroidInjector | ||
import dagger.android.HasAndroidInjector | ||
import info.nightscout.androidaps.R | ||
import info.nightscout.androidaps.interfaces.InsulinInterface | ||
import info.nightscout.androidaps.logging.AAPSLogger | ||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper | ||
import info.nightscout.androidaps.interfaces.ProfileFunction | ||
import info.nightscout.androidaps.utils.resources.ResourceHelper | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.mockito.ArgumentMatchers.eq | ||
import org.mockito.Mock | ||
import org.mockito.Mockito.`when` | ||
import org.mockito.junit.MockitoJUnit | ||
import org.mockito.junit.MockitoRule | ||
|
||
class InsulinLyumjevPluginTest { | ||
|
||
@get:Rule | ||
val mockitoRule: MockitoRule = MockitoJUnit.rule() | ||
|
||
private lateinit var sut: InsulinLyumjevPlugin | ||
|
||
@Mock lateinit var resourceHelper: ResourceHelper | ||
@Mock lateinit var rxBus: RxBusWrapper | ||
@Mock lateinit var profileFunction: ProfileFunction | ||
@Mock lateinit var aapsLogger: AAPSLogger | ||
|
||
private var injector: HasAndroidInjector = HasAndroidInjector { | ||
AndroidInjector { | ||
} | ||
} | ||
|
||
@Before | ||
fun setup() { | ||
sut = InsulinLyumjevPlugin(injector, resourceHelper, profileFunction, rxBus, aapsLogger) | ||
} | ||
|
||
@Test | ||
fun `simple peak test`() { | ||
assertEquals(45, sut.peak) | ||
} | ||
|
||
@Test | ||
fun getIdTest() { | ||
assertEquals(InsulinInterface.OREF_LYUMJEV, sut.id) | ||
} | ||
|
||
@Test | ||
fun commentStandardTextTest() { | ||
`when`(resourceHelper.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev") | ||
assertEquals("Lyumjev", sut.commentStandardText()) | ||
} | ||
|
||
@Test | ||
fun getFriendlyNameTest() { | ||
`when`(resourceHelper.gs(eq(R.string.lyumjev))).thenReturn("Lyumjev") | ||
assertEquals("Lyumjev", sut.friendlyName) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters