From 7a5d8e2ec962145c8a9e120e5b8f2358ccf5087e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 21 Mar 2018 07:51:27 +0100 Subject: [PATCH] use US locale in tests --- .../nightscout/androidaps/data/ProfileTest.java | 8 +++++--- .../interfaces/ConstraintsCheckerTest.java | 16 +++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.java b/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.java index ee04a6613a..664515d45d 100644 --- a/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.java +++ b/app/src/test/java/info/nightscout/androidaps/data/ProfileTest.java @@ -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); diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java index 3a290f098b..7040e2d9d0 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java @@ -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 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);