Source tests

This commit is contained in:
Milos Kozak 2020-03-12 00:11:17 +01:00
parent 64184f164f
commit 6e86a32210
7 changed files with 100 additions and 68 deletions

View file

@ -1,19 +1,16 @@
package info.nightscout.androidaps.plugins.source
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.TestBase
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.Mock
import org.mockito.junit.MockitoJUnit
import org.mockito.junit.MockitoRule
class GlimpPluginTest {
@get:Rule
val mockitoRule: MockitoRule = MockitoJUnit.rule()
class GlimpPluginTest : TestBase() {
private lateinit var glimpPlugin: GlimpPlugin
@Mock lateinit var aapsLogger: AAPSLogger
@ -21,7 +18,7 @@ class GlimpPluginTest {
@Before
fun setup() {
glimpPlugin = GlimpPlugin(resourceHelper, aapsLogger)
glimpPlugin = GlimpPlugin(HasAndroidInjector { AndroidInjector { } }, resourceHelper, aapsLogger)
}
@Test fun advancedFilteringSupported() {

View file

@ -1,20 +0,0 @@
package info.nightscout.androidaps.plugins.source;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
public class MM640GPluginTest {
@Test
public void getPlugin() {
Assert.assertNotEquals(null, MM640gPlugin.getPlugin());
}
@Test
public void advancedFilteringSupported() {
Assert.assertEquals(false, MM640gPlugin.getPlugin().advancedFilteringSupported());
}
}

View file

@ -0,0 +1,31 @@
package info.nightscout.androidaps.plugins.source
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.TestBase
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MM640GPluginTest : TestBase() {
private lateinit var mM640gPlugin: MM640gPlugin
@Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var resourceHelper: ResourceHelper
@Before
fun setup() {
mM640gPlugin = MM640gPlugin(HasAndroidInjector { AndroidInjector { } }, resourceHelper, aapsLogger)
}
@Test fun advancedFilteringSupported() {
Assert.assertEquals(false, mM640gPlugin.advancedFilteringSupported())
}
}

View file

@ -1,20 +0,0 @@
package info.nightscout.androidaps.plugins.source;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
public class NSClientPluginTest {
@Test
public void getPlugin() {
Assert.assertNotEquals(null, NSClientPlugin.getPlugin());
}
@Test
public void advancedFilteringSupported() {
Assert.assertEquals(false, NSClientPlugin.getPlugin().advancedFilteringSupported());
}
}

View file

@ -0,0 +1,33 @@
package info.nightscout.androidaps.plugins.source
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.TestBase
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class NSClientPluginTest : TestBase() {
private lateinit var nsClientSourcePlugin: NSClientSourcePlugin
@Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var sp: SP
@Before
fun setup() {
nsClientSourcePlugin = NSClientSourcePlugin(HasAndroidInjector { AndroidInjector { } }, resourceHelper, aapsLogger, sp)
}
@Test fun advancedFilteringSupported() {
Assert.assertEquals(false, nsClientSourcePlugin.advancedFilteringSupported())
}
}

View file

@ -1,20 +0,0 @@
package info.nightscout.androidaps.plugins.source;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
public class XdripPluginTest {
@Test
public void getPlugin() {
Assert.assertNotEquals(null, XdripPlugin.getPlugin());
}
@Test
public void advancedFilteringSupported() {
Assert.assertEquals(false, XdripPlugin.getPlugin().advancedFilteringSupported());
}
}

View file

@ -0,0 +1,31 @@
package info.nightscout.androidaps.plugins.source
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.TestBase
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class XdripPluginTest : TestBase() {
private lateinit var xdripPlugin: XdripPlugin
@Mock lateinit var aapsLogger: AAPSLogger
@Mock lateinit var resourceHelper: ResourceHelper
@Before
fun setup() {
xdripPlugin = XdripPlugin(HasAndroidInjector { AndroidInjector { } }, resourceHelper, aapsLogger)
}
@Test fun advancedFilteringSupported() {
Assert.assertEquals(false, xdripPlugin.advancedFilteringSupported())
}
}