fix tests, add crashlitycs to .ignore
This commit is contained in:
parent
073b522b93
commit
a590b1590a
6 changed files with 62 additions and 8 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -11,3 +11,5 @@ app/src/main/jniLibs
|
|||
full/
|
||||
debug/
|
||||
release/
|
||||
app/com.crashlytics.settings.json
|
||||
app/session_analytics.tap
|
|
@ -4,17 +4,27 @@ import junit.framework.Assert;
|
|||
|
||||
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 org.powermock.modules.junit4.PowerMockRunner;
|
|||
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 class ConfigBuilderPluginTest {
|
|||
}
|
||||
|
||||
@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,7 +1,18 @@
|
|||
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;
|
||||
|
||||
|
@ -9,10 +20,15 @@ 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,9 +2,15 @@ package info.nightscout.androidaps.plugins.PumpdanaRv2.comm;
|
|||
|
||||
|
||||
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;
|
||||
|
||||
|
@ -12,10 +18,16 @@ 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 class AbstractSensitivityPluginTest {
|
|||
|
||||
@Test
|
||||
public void fillResultTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
|
||||
SensitivityTestClass sut = new SensitivityTestClass();
|
||||
|
||||
AutosensResult ar = sut.fillResult(1d, 1d, "1",
|
||||
|
|
Loading…
Reference in a new issue