Skip to content
Permalink
Browse files

fix tests, add crashlitycs to .ignore

  • Loading branch information...
MilosKozak committed Jul 30, 2018
1 parent 073b522 commit a590b1590a54975bc0c58ca975415a0e9a4d9d15
@@ -10,4 +10,6 @@ build/
app/src/main/jniLibs
full/
debug/
release/
release/
app/com.crashlytics.settings.json
app/session_analytics.tap
@@ -4,17 +4,27 @@

import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.utils.SP;

/**
* Created by mike on 19.03.2018.
*/

@RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, SP.class})
public class ConstraintTest {

@Test
public void doTests() throws Exception {
public void doTests() {
AAPSMocker.mockMainApp();
AAPSMocker.mockApplicationContext();
AAPSMocker.mockSP();

Constraint<Boolean> b = new Constraint<>(true);
Assert.assertEquals(Boolean.TRUE, b.value());
Assert.assertEquals("", b.getReasons());
@@ -12,11 +12,12 @@
import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.utils.SP;

import static org.powermock.api.mockito.PowerMockito.mock;

@RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class})
@PrepareForTest({MainApp.class, SP.class})
public class ConfigBuilderPluginTest {

@Test
@@ -41,9 +42,10 @@ public void onStopTest() {
}

@Before
public void prepareMock() throws Exception {
MainApp mainApp = mock(MainApp.class);
PowerMockito.mockStatic(MainApp.class);
public void prepareMock() {
AAPSMocker.mockMainApp();
AAPSMocker.mockApplicationContext();
AAPSMocker.mockSP();
AAPSMocker.prepareMockedBus();
}

@@ -1,18 +1,34 @@
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;


import android.content.Context;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;

import static org.junit.Assert.assertEquals;

/**
* Created by mike on 20.11.2017.
*/

@RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, SP.class})
public class DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest extends DanaRS_Packet_APS_Basal_Set_Temporary_Basal {

@Test
public void runTest() throws Exception {
public void runTest() {
AAPSMocker.mockMainApp();
AAPSMocker.mockApplicationContext();
AAPSMocker.mockSP();
// under 100% should last 30 min
setParams(0);
assertEquals(0, temporaryBasalRatio);
@@ -2,20 +2,32 @@


import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_APS_Basal_Set_Temporary_Basal;
import info.nightscout.androidaps.plugins.PumpDanaRv2.comm.MsgSetAPSTempBasalStart_v2;
import info.nightscout.utils.SP;

import static org.junit.Assert.assertEquals;

/**
* Created by mike on 20.11.2017.
*/

@RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, SP.class})
public class MsgSetAPSTempBasalStart_v2Test extends MsgSetAPSTempBasalStart_v2 {

@Test
public void runTest() throws Exception {
public void runTest() {
AAPSMocker.mockMainApp();
AAPSMocker.mockApplicationContext();
AAPSMocker.mockSP();

// under 100% should last 30 min
setParams(0);
assertEquals(0, intFromBuff(buffer, 0, 2));
@@ -1,13 +1,21 @@
package info.nightscout.androidaps.plugins.Sensitivity;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensResult;
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.utils.SP;

import static org.junit.Assert.assertEquals;

@RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, SP.class})
public class AbstractSensitivityPluginTest {

private class SensitivityTestClass extends AbstractSensitivityPlugin {
@@ -28,6 +36,10 @@ public AutosensResult detectSensitivity(IobCobCalculatorPlugin plugin, long from

@Test
public void fillResultTest() {
AAPSMocker.mockMainApp();
AAPSMocker.mockApplicationContext();
AAPSMocker.mockSP();

SensitivityTestClass sut = new SensitivityTestClass();

AutosensResult ar = sut.fillResult(1d, 1d, "1",

0 comments on commit a590b15

Please sign in to comment.
You can’t perform that action at this time.