update mockito
This commit is contained in:
parent
7a8de9221b
commit
d1a647830f
9 changed files with 17 additions and 10 deletions
|
@ -258,7 +258,7 @@ dependencies {
|
||||||
testImplementation "org.skyscreamer:jsonassert:1.5.0"
|
testImplementation "org.skyscreamer:jsonassert:1.5.0"
|
||||||
testImplementation "org.hamcrest:hamcrest-all:1.3"
|
testImplementation "org.hamcrest:hamcrest-all:1.3"
|
||||||
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0-alpha03'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0-alpha04'
|
||||||
androidTestImplementation "androidx.test.ext:junit:$androidx_junit"
|
androidTestImplementation "androidx.test.ext:junit:$androidx_junit"
|
||||||
androidTestImplementation "androidx.test:rules:$androidx_rules"
|
androidTestImplementation "androidx.test:rules:$androidx_rules"
|
||||||
|
|
||||||
|
|
BIN
app/jacoco.exec
Normal file
BIN
app/jacoco.exec
Normal file
Binary file not shown.
|
@ -8,6 +8,9 @@ import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.TestBaseWithProfile
|
import info.nightscout.androidaps.TestBaseWithProfile
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
import info.nightscout.androidaps.dana.DanaPump
|
||||||
|
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||||
|
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||||
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
|
@ -20,9 +23,6 @@ import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
|
||||||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
||||||
|
@ -47,7 +47,7 @@ import java.util.*
|
||||||
* Created by mike on 18.03.2018.
|
* Created by mike on 18.03.2018.
|
||||||
*/
|
*/
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
@PrepareForTest(MainApp::class, ConfigBuilderPlugin::class, ConstraintChecker::class, SP::class, Context::class, OpenAPSAMAPlugin::class, OpenAPSSMBPlugin::class, TreatmentsPlugin::class, TreatmentService::class, VirtualPumpPlugin::class, DetailedBolusInfoStorage::class, GlimpPlugin::class, Profiler::class)
|
@PrepareForTest(MainApp::class, ConfigBuilderPlugin::class, ConstraintChecker::class, SP::class, Context::class, OpenAPSAMAPlugin::class, OpenAPSSMBPlugin::class, TreatmentsPlugin::class, TreatmentService::class, VirtualPumpPlugin::class, DetailedBolusInfoStorage::class, GlimpPlugin::class, Profiler::class, UserEntryLogger::class)
|
||||||
class ConstraintsCheckerTest : TestBaseWithProfile() {
|
class ConstraintsCheckerTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||||
|
|
|
@ -16,9 +16,11 @@ import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||||
import org.powermock.modules.junit4.PowerMockRunner
|
import org.powermock.modules.junit4.PowerMockRunner
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
|
@PrepareForTest(UserEntryLogger::class)
|
||||||
class ConfigBuilderPluginTest : TestBase() {
|
class ConfigBuilderPluginTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var virtualPumpPlugin: Lazy<VirtualPumpPlugin>
|
@Mock lateinit var virtualPumpPlugin: Lazy<VirtualPumpPlugin>
|
||||||
|
|
|
@ -18,8 +18,10 @@ import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||||
import org.powermock.modules.junit4.PowerMockRunner
|
import org.powermock.modules.junit4.PowerMockRunner
|
||||||
|
|
||||||
|
@PrepareForTest(UserEntryLogger::class)
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
class ObjectivesPluginTest : TestBase() {
|
class ObjectivesPluginTest : TestBase() {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.junit.Assert
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||||
import org.powermock.modules.junit4.PowerMockRunner
|
import org.powermock.modules.junit4.PowerMockRunner
|
||||||
|
@ -24,6 +23,7 @@ class ClassicPrefsFormatTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var resourceHelper: ResourceHelper
|
@Mock lateinit var resourceHelper: ResourceHelper
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
|
@Mock lateinit var file: MockedFile
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun preferenceLoadingTest() {
|
fun preferenceLoadingTest() {
|
||||||
|
@ -53,8 +53,9 @@ class ClassicPrefsFormatTest : TestBase() {
|
||||||
classicFormat.savePreferences(getMockedFile(), prefs)
|
classicFormat.savePreferences(getMockedFile(), prefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MockedFile(s: String) : File(s)
|
||||||
|
|
||||||
private fun getMockedFile(): File {
|
private fun getMockedFile(): File {
|
||||||
val file = Mockito.mock(File::class.java)
|
|
||||||
`when`(file.exists()).thenReturn(true)
|
`when`(file.exists()).thenReturn(true)
|
||||||
`when`(file.canRead()).thenReturn(true)
|
`when`(file.canRead()).thenReturn(true)
|
||||||
`when`(file.canWrite()).thenReturn(true)
|
`when`(file.canWrite()).thenReturn(true)
|
||||||
|
|
|
@ -28,6 +28,7 @@ class EncryptedPrefsFormatTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var resourceHelper: ResourceHelper
|
@Mock lateinit var resourceHelper: ResourceHelper
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
|
@Mock lateinit var file: MockedFile
|
||||||
|
|
||||||
private var cryptoUtil: CryptoUtil = CryptoUtil(aapsLogger)
|
private var cryptoUtil: CryptoUtil = CryptoUtil(aapsLogger)
|
||||||
|
|
||||||
|
@ -228,8 +229,9 @@ class EncryptedPrefsFormatTest : TestBase() {
|
||||||
encryptedFormat.loadPreferences(getMockedFile(), "sikret")
|
encryptedFormat.loadPreferences(getMockedFile(), "sikret")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MockedFile(s: String) : File(s)
|
||||||
|
|
||||||
private fun getMockedFile(): File {
|
private fun getMockedFile(): File {
|
||||||
val file = Mockito.mock(File::class.java)
|
|
||||||
Mockito.`when`(file.exists()).thenReturn(true)
|
Mockito.`when`(file.exists()).thenReturn(true)
|
||||||
Mockito.`when`(file.canRead()).thenReturn(true)
|
Mockito.`when`(file.canRead()).thenReturn(true)
|
||||||
Mockito.`when`(file.canWrite()).thenReturn(true)
|
Mockito.`when`(file.canWrite()).thenReturn(true)
|
||||||
|
|
|
@ -51,7 +51,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
@PrepareForTest(ConstraintChecker::class, FabricPrivacy::class, VirtualPumpPlugin::class, XdripCalibrations::class, SmsManager::class, CommandQueue::class, LocalProfilePlugin::class, DateUtil::class, IobCobCalculatorPlugin::class, OneTimePassword::class)
|
@PrepareForTest(ConstraintChecker::class, FabricPrivacy::class, VirtualPumpPlugin::class, XdripCalibrations::class, SmsManager::class, CommandQueue::class, LocalProfilePlugin::class, DateUtil::class, IobCobCalculatorPlugin::class, OneTimePassword::class, UserEntryLogger::class)
|
||||||
class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Mock lateinit var context: Context
|
@Mock lateinit var context: Context
|
||||||
|
|
|
@ -25,7 +25,7 @@ buildscript {
|
||||||
work_version = '2.5.0'
|
work_version = '2.5.0'
|
||||||
|
|
||||||
junit_version = '4.13.1'
|
junit_version = '4.13.1'
|
||||||
mockitoVersion = '2.8.47'
|
mockitoVersion = '3.7.7'
|
||||||
powermockVersion = '2.0.9'
|
powermockVersion = '2.0.9'
|
||||||
dexmakerVersion = "1.2"
|
dexmakerVersion = "1.2"
|
||||||
retrofit2Version = '2.9.0'
|
retrofit2Version = '2.9.0'
|
||||||
|
|
Loading…
Reference in a new issue