Fixed tests
This commit is contained in:
parent
a86c654f8d
commit
f8c621dc6a
2 changed files with 1 additions and 58 deletions
|
@ -156,7 +156,7 @@ public class ConstraintsCheckerTest {
|
|||
// Apply all limits
|
||||
Constraint<Double> d = constraintChecker.getMaxBasalAllowed(AAPSMocker.getValidProfile());
|
||||
Assert.assertEquals(0.8d, d.value());
|
||||
Assert.assertEquals(true, d.getReasonList().size() == 7); // 4x Safety & RS & R & Insight
|
||||
Assert.assertEquals(true, d.getReasonList().size() == 6);
|
||||
Assert.assertEquals("DanaR: Limiting basal rate to 0.80 U/h because of pump limit", d.getMostLimitedReasons());
|
||||
|
||||
}
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.PumpInsight;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Before;
|
||||
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.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpInsight.connector.StatusTaskRunner;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 23.03.2018.
|
||||
*/
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, ToastUtils.class, Context.class})
|
||||
public class InsightPluginTest {
|
||||
|
||||
InsightPlugin insightPlugin;
|
||||
|
||||
@Test
|
||||
public void basalRateShouldBeLimited() throws Exception {
|
||||
insightPlugin.setPluginEnabled(PluginType.PUMP, true);
|
||||
StatusTaskRunner.Result result = new StatusTaskRunner.Result();
|
||||
result.maximumBasalAmount = 1.1d;
|
||||
insightPlugin.setStatusResult(result);
|
||||
|
||||
Constraint<Double> c = new Constraint<>(Constants.REALLYHIGHBASALRATE);
|
||||
insightPlugin.applyBasalConstraints(c, AAPSMocker.getValidProfile());
|
||||
Assert.assertEquals(1.1d, c.value());
|
||||
Assert.assertEquals("Insight: Limiting basal rate to 1.10 U/h because of pump limit", c.getReasons());
|
||||
Assert.assertEquals("Insight: Limiting basal rate to 1.10 U/h because of pump limit", c.getMostLimitedReasons());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void prepareMocks() throws Exception {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockConfigBuilder();
|
||||
AAPSMocker.mockBus();
|
||||
AAPSMocker.mockStrings();
|
||||
AAPSMocker.mockCommandQueue();
|
||||
|
||||
insightPlugin = InsightPlugin.getPlugin();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue