Merge branch 'dagger3' into dagger3-0111a
This commit is contained in:
commit
1c2036d1a3
|
@ -118,6 +118,10 @@ class VersionCheckerUtils @Inject constructor() {
|
||||||
private fun String?.toNumberList() =
|
private fun String?.toNumberList() =
|
||||||
this?.numericVersionPart().takeIf { !it.isNullOrBlank() }?.split(".")?.map { it.toInt() }
|
this?.numericVersionPart().takeIf { !it.isNullOrBlank() }?.split(".")?.map { it.toInt() }
|
||||||
|
|
||||||
|
fun findVersion(file: String?): String? {
|
||||||
|
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
|
||||||
|
return file?.lines()?.filter { regex.matches(it) }?.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }?.firstOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val CHECK_EVERY = TimeUnit.DAYS.toMillis(1)
|
private val CHECK_EVERY = TimeUnit.DAYS.toMillis(1)
|
||||||
|
|
|
@ -1,25 +1,49 @@
|
||||||
package info.nightscout.androidaps.plugins.constraints.versionChecker
|
package info.nightscout.androidaps.plugins.constraints.versionChecker
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.L
|
import info.nightscout.androidaps.logging.L
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.utils.SP
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Assert.fail
|
import org.junit.Assert.fail
|
||||||
|
import org.junit.Before
|
||||||
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mockito.*
|
import org.mockito.Mock
|
||||||
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.mockito.Mockito.any
|
||||||
|
import org.mockito.Mockito.eq
|
||||||
|
import org.mockito.Mockito.mock
|
||||||
|
import org.mockito.Mockito.times
|
||||||
|
import org.mockito.junit.MockitoJUnit
|
||||||
|
import org.mockito.junit.MockitoRule
|
||||||
import org.powermock.api.mockito.PowerMockito
|
import org.powermock.api.mockito.PowerMockito
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||||
import org.powermock.modules.junit4.PowerMockRunner
|
|
||||||
|
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
|
||||||
class VersionCheckerUtilsKtTest {
|
class VersionCheckerUtilsKtTest {
|
||||||
|
|
||||||
|
|
||||||
|
@get:Rule
|
||||||
|
val mockitoRule: MockitoRule = MockitoJUnit.rule()
|
||||||
|
|
||||||
|
lateinit var versionCheckerUtils: VersionCheckerUtils
|
||||||
|
|
||||||
|
@Mock lateinit var aapsLogger: AAPSLogger
|
||||||
|
@Mock lateinit var sp: info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
|
@Mock lateinit var resourceHelper: ResourceHelper
|
||||||
|
@Mock lateinit var rxBusWrapper: RxBusWrapper
|
||||||
|
@Mock lateinit var context: Context
|
||||||
|
|
||||||
|
@Before fun setup() {
|
||||||
|
versionCheckerUtils = VersionCheckerUtils()
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Test
|
@Test
|
||||||
fun `should keep 2 digit version`() {
|
fun `should keep 2 digit version`() {
|
||||||
assertEquals("1.2", "1.2".numericVersionPart())
|
assertEquals("1.2", "1.2".numericVersionPart())
|
||||||
|
@ -80,7 +104,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
assertEquals("1.2", "1.2.RC5".numericVersionPart())
|
assertEquals("1.2", "1.2.RC5".numericVersionPart())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
fun findVersionMatchesRegularVersion() {
|
fun findVersionMatchesRegularVersion() {
|
||||||
val buildGradle = """blabla
|
val buildGradle = """blabla
|
||||||
|
@ -90,11 +114,10 @@ class VersionCheckerUtilsKtTest {
|
||||||
| version = "2.2.2"
|
| version = "2.2.2"
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
val detectedVersion: String? = findVersion(buildGradle)
|
val detectedVersion: String? = versionCheckerUtils.findVersion(buildGradle)
|
||||||
assertEquals("2.2.2", detectedVersion)
|
assertEquals("2.2.2", detectedVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// In case we merge a "x.x.x-dev" into master, don't see it as update.
|
// In case we merge a "x.x.x-dev" into master, don't see it as update.
|
||||||
@Test
|
@Test
|
||||||
fun `should return null on non-digit versions on master`() {
|
fun `should return null on non-digit versions on master`() {
|
||||||
|
@ -105,17 +128,18 @@ class VersionCheckerUtilsKtTest {
|
||||||
| version = "2.2.2-nefarious-underground-mod"
|
| version = "2.2.2-nefarious-underground-mod"
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
val detectedVersion: String? = findVersion(buildGradle)
|
val detectedVersion: String? = versionCheckerUtils.findVersion(buildGradle)
|
||||||
assertEquals(null, detectedVersion)
|
assertEquals(null, detectedVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun findVersionMatchesDoesNotMatchErrorResponse() {
|
fun findVersionMatchesDoesNotMatchErrorResponse() {
|
||||||
val buildGradle = """<html><body>Balls! No build.gradle here. Move along</body><html>"""
|
val buildGradle = """<html><body>Balls! No build.gradle here. Move along</body><html>"""
|
||||||
val detectedVersion: String? = findVersion(buildGradle)
|
val detectedVersion: String? = versionCheckerUtils.findVersion(buildGradle)
|
||||||
assertEquals(null, detectedVersion)
|
assertEquals(null, detectedVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Test
|
@Test
|
||||||
fun testVersionStrip() {
|
fun testVersionStrip() {
|
||||||
assertEquals("2.2.2", "2.2.2".versionStrip())
|
assertEquals("2.2.2", "2.2.2".versionStrip())
|
||||||
|
@ -123,13 +147,13 @@ class VersionCheckerUtilsKtTest {
|
||||||
assertEquals("2.2.2", "2.2.2dev".versionStrip())
|
assertEquals("2.2.2", "2.2.2dev".versionStrip())
|
||||||
assertEquals("2.2.2", """"2.2.2"""".versionStrip())
|
assertEquals("2.2.2", """"2.2.2"""".versionStrip())
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `should find update1`() {
|
fun `should find update1`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
|
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1")
|
||||||
|
|
||||||
//verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
|
@ -146,7 +170,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
fun `should find update2`() {
|
fun `should find update2`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
|
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1-dev")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1-dev")
|
||||||
|
|
||||||
//verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
|
@ -162,7 +186,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
fun `should find update3`() {
|
fun `should find update3`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
|
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.1")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.1")
|
||||||
|
|
||||||
//verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
|
@ -178,7 +202,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
fun `should find update4`() {
|
fun `should find update4`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
|
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.2", currentVersion = "2.1.1")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2", currentVersion = "2.1.1")
|
||||||
|
|
||||||
//verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
|
@ -193,7 +217,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `should find update5`() {
|
fun `should find update5`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2-dev")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2-dev")
|
||||||
|
|
||||||
//verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
|
@ -208,7 +232,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `should find update6`() {
|
fun `should find update6`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2dev")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2dev")
|
||||||
|
|
||||||
//verify(bus, times(1)).post(any())
|
//verify(bus, times(1)).post(any())
|
||||||
|
|
||||||
|
@ -223,7 +247,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `should not find update on fourth version digit`() {
|
fun `should not find update on fourth version digit`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0.1")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0.1")
|
||||||
|
|
||||||
//verify(bus, times(0)).post(any())
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
@ -236,7 +260,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `should not find update on personal version with same number`() {
|
fun `should not find update on personal version with same number`() {
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0-myversion")
|
versionCheckerUtils.compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0-myversion")
|
||||||
|
|
||||||
//verify(bus, times(0)).post(any())
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
@ -245,7 +269,6 @@ class VersionCheckerUtilsKtTest {
|
||||||
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `find same version`() {
|
fun `find same version`() {
|
||||||
|
@ -257,7 +280,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2.2")
|
||||||
|
|
||||||
//verify(bus, times(0)).post(any())
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
@ -277,7 +300,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2.2")
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -286,7 +309,6 @@ class VersionCheckerUtilsKtTest {
|
||||||
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `find higher version with longer number`() {
|
fun `find higher version with longer number`() {
|
||||||
|
@ -298,7 +320,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.2.2")
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -318,7 +340,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.0-RC04")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.0-RC04")
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -338,7 +360,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.0RC04")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.0RC04")
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -358,7 +380,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.RC04")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.RC04")
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -378,7 +400,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.0.RC04")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.0.RC04")
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -398,7 +420,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.7.9")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "3.7.9")
|
||||||
|
|
||||||
PowerMockito.verifyStatic(SP::class.java, times(1))
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
@ -418,7 +440,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.3")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.3")
|
||||||
|
|
||||||
//verify(bus, times(0)).post(any())
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
@ -438,7 +460,7 @@ class VersionCheckerUtilsKtTest {
|
||||||
| appName = "Aaoeu"
|
| appName = "Aaoeu"
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
prepareMainApp()
|
prepareMainApp()
|
||||||
fail()// TODO setup as Object and test: compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.3-RC")
|
versionCheckerUtils.compareWithCurrentVersion(versionCheckerUtils.findVersion(buildGradle), currentVersion = "2.3-RC")
|
||||||
|
|
||||||
//verify(bus, times(0)).post(any())
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
@ -447,9 +469,6 @@ class VersionCheckerUtilsKtTest {
|
||||||
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@PrepareForTest(System::class)
|
@PrepareForTest(System::class)
|
||||||
fun `set time`() {
|
fun `set time`() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import junit.framework.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -62,6 +62,7 @@ class InsulinOrefFreePeakPluginTest {
|
||||||
return uninitialized()
|
return uninitialized()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("Unchecked_Cast")
|
||||||
private fun <T> uninitialized(): T = null as T
|
private fun <T> uninitialized(): T = null as T
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue