use US locale in tests

This commit is contained in:
Milos Kozak 2018-03-21 07:51:27 +01:00
parent 51ca4cc8c6
commit 7a5d8e2ec9
2 changed files with 14 additions and 10 deletions

View file

@ -13,6 +13,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import org.skyscreamer.jsonassert.JSONAssert;
import java.util.Calendar;
import java.util.Locale;
import java.util.TimeZone;
import info.nightscout.androidaps.Constants;
@ -133,9 +134,9 @@ public class ProfileTest {
// Test timeshift functionality
p = new Profile(new JSONObject(validProfile), 100, 1);
Assert.assertEquals(
"00:00 110,0 mmol/U\n" +
"01:00 100,0 mmol/U\n" +
"03:00 110,0 mmol/U", p.getIsfList().replace(".", ","));
"00:00 110.0 mmol/U\n" +
"01:00 100.0 mmol/U\n" +
"03:00 110.0 mmol/U", p.getIsfList());
// Test hour alignment
MainApp.getConfigBuilder().getActivePump().getPumpDescription().is30minBasalRatesCapable = false;
@ -146,6 +147,7 @@ public class ProfileTest {
}
private void prepareMock() throws Exception {
Locale.setDefault(new Locale("en", "US"));
ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class);
PowerMockito.mockStatic(ConfigBuilderPlugin.class);

View file

@ -17,6 +17,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
@ -199,23 +200,24 @@ public class ConstraintsCheckerTest {
Constraint<Double> d = new Constraint<>(-0.5d);
constraintChecker.applyBasalConstraints(d, profile);
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
d = new Constraint<>(Constants.REALLYHIGHBASALRATE);
constraintChecker.applyBasalConstraints(d, profile);
Assert.assertEquals(0.8d, d.value());
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 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 1,10 U/h because of pump limit", d.getReasons());
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 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 1.10 U/h because of pump limit", d.getReasons());
}
@Before
public void prepareMock() throws Exception {
Locale.setDefault(new Locale("en", "US"));
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
PowerMockito.mockStatic(MainApp.class);