use US locale in tests
This commit is contained in:
parent
51ca4cc8c6
commit
7a5d8e2ec9
2 changed files with 14 additions and 10 deletions
|
@ -13,6 +13,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
import org.skyscreamer.jsonassert.JSONAssert;
|
import org.skyscreamer.jsonassert.JSONAssert;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
|
@ -133,9 +134,9 @@ public class ProfileTest {
|
||||||
// Test timeshift functionality
|
// Test timeshift functionality
|
||||||
p = new Profile(new JSONObject(validProfile), 100, 1);
|
p = new Profile(new JSONObject(validProfile), 100, 1);
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"00:00 110,0 mmol/U\n" +
|
"00:00 110.0 mmol/U\n" +
|
||||||
"01:00 100,0 mmol/U\n" +
|
"01:00 100.0 mmol/U\n" +
|
||||||
"03:00 110,0 mmol/U", p.getIsfList().replace(".", ","));
|
"03:00 110.0 mmol/U", p.getIsfList());
|
||||||
|
|
||||||
// Test hour alignment
|
// Test hour alignment
|
||||||
MainApp.getConfigBuilder().getActivePump().getPumpDescription().is30minBasalRatesCapable = false;
|
MainApp.getConfigBuilder().getActivePump().getPumpDescription().is30minBasalRatesCapable = false;
|
||||||
|
@ -146,6 +147,7 @@ public class ProfileTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareMock() throws Exception {
|
private void prepareMock() throws Exception {
|
||||||
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class);
|
ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class);
|
||||||
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -199,23 +200,24 @@ public class ConstraintsCheckerTest {
|
||||||
Constraint<Double> d = new Constraint<>(-0.5d);
|
Constraint<Double> d = new Constraint<>(-0.5d);
|
||||||
constraintChecker.applyBasalConstraints(d, profile);
|
constraintChecker.applyBasalConstraints(d, profile);
|
||||||
Assert.assertEquals(0d, d.value());
|
Assert.assertEquals(0d, d.value());
|
||||||
Assert.assertEquals("Limiting basal rate to 0,00 U/h because of basal must be positive value", d.getReasons());
|
Assert.assertEquals("Limiting basal rate to 0.00 U/h because of basal must be positive value", d.getReasons());
|
||||||
|
|
||||||
// Apply all limits
|
// Apply all limits
|
||||||
d = new Constraint<>(Constants.REALLYHIGHBASALRATE);
|
d = new Constraint<>(Constants.REALLYHIGHBASALRATE);
|
||||||
constraintChecker.applyBasalConstraints(d, profile);
|
constraintChecker.applyBasalConstraints(d, profile);
|
||||||
Assert.assertEquals(0.8d, d.value());
|
Assert.assertEquals(0.8d, d.value());
|
||||||
Assert.assertEquals("Limiting basal rate to 1,00 U/h because of max basal settings in preferences\n" +
|
Assert.assertEquals("Limiting basal rate to 1.00 U/h because of max basal settings in preferences\n" +
|
||||||
"Limiting basal rate to 4,00 U/h because of max basal multiplier\n" +
|
"Limiting basal rate to 4.00 U/h because of max basal multiplier\n" +
|
||||||
"Limiting basal rate to 3,00 U/h because of max daily basal multiplier\n" +
|
"Limiting basal rate to 3.00 U/h because of max daily basal multiplier\n" +
|
||||||
"Limiting basal rate to 0,80 U/h because of pump limit\n" +
|
"Limiting basal rate to 0.80 U/h because of pump limit\n" +
|
||||||
"Limiting basal rate to 0,80 U/h because of pump limit\n" +
|
"Limiting basal rate to 0.80 U/h because of pump limit\n" +
|
||||||
"Limiting basal rate to 1,10 U/h because of pump limit", d.getReasons());
|
"Limiting basal rate to 1.10 U/h because of pump limit", d.getReasons());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void prepareMock() throws Exception {
|
public void prepareMock() throws Exception {
|
||||||
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
||||||
|
|
||||||
PowerMockito.mockStatic(MainApp.class);
|
PowerMockito.mockStatic(MainApp.class);
|
||||||
|
|
Loading…
Reference in a new issue