From 29ef63a830721a68e5f76272333ddca90bdb4490 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Wed, 17 Jan 2018 20:25:02 +0100 Subject: [PATCH] Move isMale to gender enum --- .../core/bluetooth/BluetoothBeurerBF700_800.java | 2 +- .../core/bluetooth/BluetoothDigooDGSO38H.java | 2 +- .../core/bluetooth/BluetoothExcelvanCF369BLE.java | 2 +- .../core/bluetooth/BluetoothExingtechY1.java | 2 +- .../openscale/core/bluetooth/BluetoothMGB.java | 2 +- .../core/bluetooth/BluetoothSanitasSbf70.java | 2 +- .../core/bluetooth/BluetoothYunmaiMini.java | 2 +- .../core/bluetooth/BluetoothYunmaiSE.java | 2 +- .../openscale/core/bodymetric/BFDeurenberg.java | 2 +- .../openscale/core/bodymetric/BFDeurenbergII.java | 2 +- .../health/openscale/core/bodymetric/BFEddy.java | 2 +- .../openscale/core/bodymetric/BFGallagher.java | 2 +- .../core/bodymetric/BFGallagherAsian.java | 2 +- .../health/openscale/core/bodymetric/LBWBoer.java | 2 +- .../health/openscale/core/bodymetric/LBWHume.java | 2 +- .../openscale/core/bodymetric/TBWBehnke.java | 2 +- .../openscale/core/bodymetric/TBWHumeWeyers.java | 2 +- .../openscale/core/bodymetric/TBWLeeSongKim.java | 2 +- .../openscale/core/datatypes/ScaleMeasurement.java | 2 +- .../health/openscale/core/datatypes/ScaleUser.java | 7 ------- .../openscale/core/evaluation/EvaluationSheet.java | 14 +++++++------- .../health/openscale/core/utils/Converters.java | 4 ++++ .../java/com.health.openscale/ConvertersTest.java | 5 +++++ 23 files changed, 35 insertions(+), 33 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF700_800.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF700_800.java index dbc77f43..d718274a 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF700_800.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF700_800.java @@ -208,7 +208,7 @@ public class BluetoothBeurerBF700_800 extends BluetoothCommunication { (byte) selectedUser.getBirthday().getMonth(), (byte) selectedUser.getBirthday().getDate(), (byte) selectedUser.getBodyHeight(), - (byte) (((selectedUser.isMale() ? 1 : 0) << 7) | activity) + (byte) (((selectedUser.getGender().isMale() ? 1 : 0) << 7) | activity) }); } else { // Get existing user information diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java index bf2d62c8..9c9245b6 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java @@ -104,7 +104,7 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication { if (weightStabilized) { //The weight is stabilized, now we want to measure all available values - byte gender = selectedUser.isMale() ? (byte)0x00: (byte)0x01; + byte gender = selectedUser.getGender().isMale() ? (byte)0x00: (byte)0x01; byte height = (byte) (selectedUser.getBodyHeight() & 0xFF); byte age = (byte)(selectedUser.getAge(new Date()) & 0xff); byte unit = 0x01; // kg diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF369BLE.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF369BLE.java index 6e6a2218..40393776 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF369BLE.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF369BLE.java @@ -61,7 +61,7 @@ public class BluetoothExcelvanCF369BLE extends BluetoothCommunication { case 0: final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser(); - byte sex = selectedUser.isMale() ? (byte)0x01 : (byte)0x00; // 01 - male; 00 - female + byte sex = selectedUser.getGender().isMale() ? (byte)0x01 : (byte)0x00; // 01 - male; 00 - female byte height = (byte)(selectedUser.getBodyHeight() & 0xff); // cm byte age = (byte)(selectedUser.getAge(new Date()) & 0xff); byte unit = 0x01; // kg diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java index 2eb0cb89..e535a334 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java @@ -58,7 +58,7 @@ public class BluetoothExingtechY1 extends BluetoothCommunication { case 1: final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser(); - byte gender = selectedUser.isMale() ? (byte)0x00 : (byte)0x01; // 00 - male; 01 - female + byte gender = selectedUser.getGender().isMale() ? (byte)0x00 : (byte)0x01; // 00 - male; 01 - female byte height = (byte)(selectedUser.getBodyHeight() & 0xff); // cm byte age = (byte)(selectedUser.getAge(new Date()) & 0xff); diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java index f269702b..38b26d9b 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java @@ -117,7 +117,7 @@ public class BluetoothMGB extends BluetoothCommunication { break; case 3: - writeCfg(0xFB, (user.isMale() ? 1 : 2), user.getAge(new Date()), user.getBodyHeight()); + writeCfg(0xFB, (user.getGender().isMale() ? 1 : 2), user.getAge(new Date()), user.getBodyHeight()); break; case 4: diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSanitasSbf70.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSanitasSbf70.java index 3d468063..fd06df16 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSanitasSbf70.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSanitasSbf70.java @@ -202,7 +202,7 @@ public class BluetoothSanitasSbf70 extends BluetoothCommunication { (byte) selectedUser.getBirthday().getMonth(), (byte) selectedUser.getBirthday().getDate(), (byte) selectedUser.getBodyHeight(), - (byte) (((selectedUser.isMale() ? 1 : 0) << 7) | activity) + (byte) (((selectedUser.getGender().isMale() ? 1 : 0) << 7) | activity) }); } else { // Get existing user information diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiMini.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiMini.java index 197d67ec..4d15e824 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiMini.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiMini.java @@ -69,7 +69,7 @@ public class BluetoothYunmaiMini extends BluetoothCommunication { int user_id = getUniqueNumber(); final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser(); - byte sex = selectedUser.isMale() ? (byte)0x01 : (byte)0x02; + byte sex = selectedUser.getGender().isMale() ? (byte)0x01 : (byte)0x02; byte display_unit = selectedUser.getScaleUnit() == Converters.WeightUnit.KG ? (byte) 0x01 : (byte) 0x02; byte[] user_add_or_query = new byte[]{(byte)0x0d, (byte)0x12, (byte)0x10, (byte)0x01, (byte)0x00, (byte) 0x00, (byte) ((user_id & 0xFF00) >> 8), (byte) ((user_id & 0xFF) >> 0), (byte)selectedUser.getBodyHeight(), (byte)sex, (byte) selectedUser.getAge(new Date()), (byte) 0x55, (byte) 0x5a, (byte) 0x00, (byte)0x00, (byte) display_unit, (byte) 0x03, (byte) 0x00 }; diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE.java index 5007ded0..24d8f8a8 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE.java @@ -69,7 +69,7 @@ public class BluetoothYunmaiSE extends BluetoothCommunication { int user_id = getUniqueNumber(); final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser(); - byte sex = selectedUser.isMale() ? (byte)0x01 : (byte)0x02; + byte sex = selectedUser.getGender().isMale() ? (byte)0x01 : (byte)0x02; byte display_unit = selectedUser.getScaleUnit() == Converters.WeightUnit.KG ? (byte) 0x01 : (byte) 0x02; byte[] user_add_or_query = new byte[]{(byte)0x0d, (byte)0x12, (byte)0x10, (byte)0x01, (byte)0x00, (byte) 0x00, (byte) ((user_id & 0xFF00) >> 8), (byte) ((user_id & 0xFF) >> 0), (byte)selectedUser.getBodyHeight(), (byte)sex, (byte) selectedUser.getAge(new Date()), (byte) 0x55, (byte) 0x5a, (byte) 0x00, (byte)0x00, (byte) display_unit, (byte) 0x03, (byte) 0x00 }; diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenberg.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenberg.java index 854a1597..b333f7ed 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenberg.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenberg.java @@ -26,7 +26,7 @@ public class BFDeurenberg extends EstimatedFatMetric { @Override public float getFat(ScaleUser user, ScaleMeasurement data) { - final int gender = user.isMale() ? 1 : 0; + final int gender = user.getGender().isMale() ? 1 : 0; if (user.getAge(data.getDateTime()) >= 16) { return (1.2f * data.getBMI(user.getBodyHeight())) + (0.23f*user.getAge(data.getDateTime())) - (10.8f * gender) - 5.4f; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenbergII.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenbergII.java index f2f45de3..c376e00b 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenbergII.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFDeurenbergII.java @@ -26,7 +26,7 @@ public class BFDeurenbergII extends EstimatedFatMetric { @Override public float getFat(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { return (data.getBMI(user.getBodyHeight()) * 1.2f) + (user.getAge(data.getDateTime()) * 0.23f) - 16.2f; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFEddy.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFEddy.java index 0fc0e2f0..ce06b1bf 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFEddy.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFEddy.java @@ -26,7 +26,7 @@ public class BFEddy extends EstimatedFatMetric { @Override public float getFat(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { return (1.281f* data.getBMI(user.getBodyHeight())) - 10.13f; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagher.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagher.java index 8dbd8c91..6b222a78 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagher.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagher.java @@ -26,7 +26,7 @@ public class BFGallagher extends EstimatedFatMetric { @Override public float getFat(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { // non-asian male return 64.5f - 848.0f * (1.0f / data.getBMI(user.getBodyHeight())) + 0.079f * user.getAge(data.getDateTime()) - 16.4f + 0.05f * user.getAge(data.getDateTime()) + 39.0f * (1.0f / data.getBMI(user.getBodyHeight())); } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagherAsian.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagherAsian.java index 7f099cc0..b06cab46 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagherAsian.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/BFGallagherAsian.java @@ -26,7 +26,7 @@ public class BFGallagherAsian extends EstimatedFatMetric { @Override public float getFat(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { // asian male return 51.9f - 740.0f * (1.0f / data.getBMI(user.getBodyHeight())) + 0.029f * user.getAge(data.getDateTime()); } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWBoer.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWBoer.java index 4fe2de96..6fba1eb1 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWBoer.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWBoer.java @@ -27,7 +27,7 @@ public class LBWBoer extends EstimatedLBWMetric { @Override public float getLBW(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { return (0.4071f * data.getWeight()) + (0.267f * user.getBodyHeight()) - 19.2f; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWHume.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWHume.java index b1830245..45fcee24 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWHume.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/LBWHume.java @@ -27,7 +27,7 @@ public class LBWHume extends EstimatedLBWMetric { @Override public float getLBW(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { return (0.32810f * data.getWeight()) + (0.33929f * user.getBodyHeight()) - 29.5336f; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWBehnke.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWBehnke.java index 4d4eeb6f..0378d53d 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWBehnke.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWBehnke.java @@ -26,7 +26,7 @@ public class TBWBehnke extends EstimatedWaterMetric { @Override public float getWater(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { return 0.72f * (0.204f * user.getBodyHeight() * user.getBodyHeight()) / 100.0f; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWHumeWeyers.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWHumeWeyers.java index cd4e823f..0f864c0a 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWHumeWeyers.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWHumeWeyers.java @@ -26,7 +26,7 @@ public class TBWHumeWeyers extends EstimatedWaterMetric { @Override public float getWater(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { return (0.194786f * user.getBodyHeight()) + (0.296785f * data.getWeight()) - 14.012934f; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWLeeSongKim.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWLeeSongKim.java index e5e5c219..8fc36da8 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWLeeSongKim.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/TBWLeeSongKim.java @@ -26,7 +26,7 @@ public class TBWLeeSongKim extends EstimatedWaterMetric { @Override public float getWater(ScaleUser user, ScaleMeasurement data) { - if (user.isMale()) { + if (user.getGender().isMale()) { return -28.3497f + (0.243057f * user.getBodyHeight()) + (0.366248f * data.getWeight()); } diff --git a/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleMeasurement.java b/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleMeasurement.java index 53a7bf8e..f797ef90 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleMeasurement.java +++ b/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleMeasurement.java @@ -234,7 +234,7 @@ public class ScaleMeasurement implements Cloneable { float bmr = 0.0f; // BMR formula by Mifflin, St Jeor et al: A new predictive equation for resting energy expenditure in healthy individuals - if (scaleUser.isMale()) { + if (scaleUser.getGender().isMale()) { bmr = 10.0f * weight + 6.25f * scaleUser.getBodyHeight() - 5.0f * scaleUser.getAge(dateTime) + 5.0f; } else { bmr = 10.0f * weight + 6.25f * scaleUser.getBodyHeight() - 5.0f * scaleUser.getAge(dateTime) - 161.0f; diff --git a/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleUser.java b/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleUser.java index 94e5e735..d99df719 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleUser.java +++ b/android_app/app/src/main/java/com/health/openscale/core/datatypes/ScaleUser.java @@ -126,13 +126,6 @@ public class ScaleUser { this.goalDate = goalDate; } - public boolean isMale() { - if (gender == Converters.Gender.MALE) { - return true; - } - return false; - } - public int getAge(Date todayDate) { Calendar calToday = Calendar.getInstance(); calToday.setTime(todayDate); diff --git a/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java b/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java index a54756c8..fe538e3c 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java +++ b/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java @@ -170,7 +170,7 @@ public class EvaluationSheet { float lowLimit = 0.0f; float highLimit = 0.0f; - if (evalUser.isMale()) { + if (evalUser.getGender().isMale()) { lowLimit = body_height_squared * 20.0f; highLimit = body_height_squared * 25.0f; } else { @@ -193,7 +193,7 @@ public class EvaluationSheet { public EvaluationResult evaluateBodyFat(float fat) { List bodyEvaluateSheet; - if (evalUser.isMale()) { + if (evalUser.getGender().isMale()) { bodyEvaluateSheet = fatEvaluateSheet_Man; } else { bodyEvaluateSheet = fatEvaluateSheet_Woman; @@ -205,7 +205,7 @@ public class EvaluationSheet { public EvaluationResult evaluateBodyWater(float water) { List bodyEvaluateSheet; - if (evalUser.isMale()) { + if (evalUser.getGender().isMale()) { bodyEvaluateSheet = waterEvaluateSheet_Man; } else { bodyEvaluateSheet = waterEvaluateSheet_Woman; @@ -217,7 +217,7 @@ public class EvaluationSheet { public EvaluationResult evaluateBodyMuscle(float muscle) { List bodyEvaluateSheet; - if (evalUser.isMale()) { + if (evalUser.getGender().isMale()) { bodyEvaluateSheet = muscleEvaluateSheet_Man; } else { bodyEvaluateSheet = muscleEvaluateSheet_Woman; @@ -229,7 +229,7 @@ public class EvaluationSheet { public EvaluationResult evaluateBMI(float bmi) { List bodyEvaluateSheet; - if (evalUser.isMale()) { + if (evalUser.getGender().isMale()) { bodyEvaluateSheet = bmiEvaluateSheet_Man; } else { bodyEvaluateSheet = bmiEvaluateSheet_Woman; @@ -241,7 +241,7 @@ public class EvaluationSheet { public EvaluationResult evaluateWaist(float waist) { List bodyEvaluateSheet; - if (evalUser.isMale()) { + if (evalUser.getGender().isMale()) { bodyEvaluateSheet = waistEvaluateSheet_Man; } else { bodyEvaluateSheet = waistEvaluateSheet_Woman; @@ -257,7 +257,7 @@ public class EvaluationSheet { public EvaluationResult evaluateWHR(float whr) { List bodyEvaluateSheet; - if (evalUser.isMale()) { + if (evalUser.getGender().isMale()) { bodyEvaluateSheet = whrEvaluateSheet_Man; } else { bodyEvaluateSheet = whrEvaluateSheet_Woman; diff --git a/android_app/app/src/main/java/com/health/openscale/core/utils/Converters.java b/android_app/app/src/main/java/com/health/openscale/core/utils/Converters.java index 1f8f9ca4..1d2daf43 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/utils/Converters.java +++ b/android_app/app/src/main/java/com/health/openscale/core/utils/Converters.java @@ -58,6 +58,10 @@ public class Converters { public enum Gender { MALE, FEMALE; + public boolean isMale() { + return this == MALE; + } + public static Gender fromInt(int gender) { return gender == 0 ? MALE : FEMALE; } diff --git a/android_app/app/src/test/java/com.health.openscale/ConvertersTest.java b/android_app/app/src/test/java/com.health.openscale/ConvertersTest.java index 296f8f68..715081e1 100644 --- a/android_app/app/src/test/java/com.health.openscale/ConvertersTest.java +++ b/android_app/app/src/test/java/com.health.openscale/ConvertersTest.java @@ -21,6 +21,8 @@ import com.health.openscale.core.utils.Converters; import org.junit.Test; import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertTrue; public class ConvertersTest { @@ -65,6 +67,9 @@ public class ConvertersTest { assertEquals("MALE", Converters.Gender.MALE.toString()); assertEquals("FEMALE", Converters.Gender.FEMALE.toString()); + + assertTrue(Converters.Gender.MALE.isMale()); + assertFalse(Converters.Gender.FEMALE.isMale()); } @Test