From 7ce5fd23a47d426d28137cc34b55aec872c09d9d Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Fri, 22 Dec 2017 22:50:04 +0100 Subject: [PATCH 1/5] Show days since current date in overview I find it more logical to see how long ago a measurement was done, instead of how long ago since the last measurement was a measurement done. Fix a bug where the days since a measurement was calculated incorrectly if the measurement was done in the previous year. Convert the days label to plurals so that "day" is used when the measurement was done yesterday. --- .../gui/fragments/OverviewFragment.java | 22 +++++++------------ .../gui/fragments/StatisticsFragment.java | 19 ++++++---------- .../app/src/main/res/values-de/strings.xml | 5 ++++- .../app/src/main/res/values-es/strings.xml | 5 ++++- .../app/src/main/res/values-fr/strings.xml | 5 ++++- .../app/src/main/res/values-ja/strings.xml | 4 +++- .../app/src/main/res/values-pl/strings.xml | 4 +++- .../app/src/main/res/values-pt/strings.xml | 4 +++- .../app/src/main/res/values-sk/strings.xml | 4 +++- .../app/src/main/res/values-sv/strings.xml | 5 ++++- .../app/src/main/res/values-tr/strings.xml | 4 +++- .../app/src/main/res/values/strings.xml | 5 ++++- 12 files changed, 50 insertions(+), 36 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java index 6b4dc187..9cac71a3 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java @@ -54,7 +54,7 @@ import com.health.openscale.gui.views.WeightMeasurementView; import java.text.DateFormat; import java.util.ArrayList; -import java.util.Calendar; +import java.util.Date; import java.util.List; import lecho.lib.hellocharts.formatter.SimpleLineChartValueFormatter; @@ -255,12 +255,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener max_i = scaleDataList.size(); } - Calendar histDate = Calendar.getInstance(); - Calendar lastDate = Calendar.getInstance(); - - if (!scaleDataList.isEmpty()) { - lastDate.setTime(scaleDataList.get(0).getDateTime()); - } + Date now = new Date(); scaleDataLastDays = new ArrayList(); @@ -285,11 +280,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener if (histData.getBone() != 0.0f) valuesBone.add(new PointValue(i, histData.getBone())); - histDate.setTime(histData.getDateTime()); - - long days = 0 - daysBetween(lastDate, histDate); - - axisValues.add(new AxisValue(i, String.format("%d " + getResources().getString(R.string.label_days), days).toCharArray())); + int days = daysBetween(now, histData.getDateTime()); + String label = getResources().getQuantityString(R.plurals.label_days, Math.abs(days), days); + axisValues.add(new AxisValue(i, label.toCharArray())); } Line lineWeight = new Line(valuesWeight). @@ -428,8 +421,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener pieChartLast.setPieChartData(pieChartData); } - private long daysBetween(Calendar startDate, Calendar endDate) { - return startDate.get(Calendar.DAY_OF_YEAR) - endDate.get(Calendar.DAY_OF_YEAR); + private int daysBetween(Date startDate, Date endDate) { + final float msPerDay = 24 * 60 * 60 * 1000; + return Math.round((endDate.getTime() - startDate.getTime()) / msPerDay); } public void btnOnClickInsertData() diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java index 276c2549..f4c6aad3 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java @@ -34,7 +34,7 @@ import com.health.openscale.core.datatypes.ScaleUser; import java.text.DateFormat; import java.util.ArrayList; import java.util.Calendar; -import java.util.concurrent.TimeUnit; +import java.util.Date; public class StatisticsFragment extends Fragment implements FragmentUpdateListener { @@ -99,7 +99,7 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen txtTitleStatistics.setText(getResources().getString(R.string.label_title_statistics).toUpperCase()); prefs = PreferenceManager.getDefaultSharedPreferences(statisticsView.getContext()); - currentScaleUser = OpenScale.getInstance(getContext()).getSelectedScaleUser(); + currentScaleUser = OpenScale.getInstance(getContext()).getSelectedScaleUser(); updateStatistics(scaleDataList); updateGoal(scaleDataList); @@ -114,12 +114,8 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen double weight_diff = goalScaleData.getConvertedWeight(currentScaleUser.scale_unit) - lastScaleData.getConvertedWeight(currentScaleUser.scale_unit); txtGoalDiff.setText(String.format("%.1f " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit], weight_diff)); - Calendar goalDate = Calendar.getInstance(); - Calendar curDate = Calendar.getInstance(); - goalDate.setTime(currentScaleUser.goal_date); - - long days = daysBetween(curDate, goalDate); - txtGoalDayLeft.setText(days + " " + getResources().getString(R.string.label_days)); + int days = Math.max(0, daysBetween(new Date(), currentScaleUser.goal_date)); + txtGoalDayLeft.setText(getResources().getQuantityString(R.plurals.label_days, days, days)); lastScaleData.setUserId(currentScaleUser.id); @@ -335,9 +331,8 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen txtAvgMonth.setText(monthSize + " " + getResources().getString(R.string.label_measures)); } - private long daysBetween(Calendar startDate, Calendar endDate) { - long end = endDate.getTimeInMillis(); - long start = startDate.getTimeInMillis(); - return TimeUnit.MILLISECONDS.toDays(Math.abs(end - start)); + private int daysBetween(Date startDate, Date endDate) { + final float msPerDay = 24 * 60 * 60 * 1000; + return (int)Math.ceil((endDate.getTime() - startDate.getTime()) / msPerDay); } } diff --git a/android_app/app/src/main/res/values-de/strings.xml b/android_app/app/src/main/res/values-de/strings.xml index 69943f6a..1b8df397 100644 --- a/android_app/app/src/main/res/values-de/strings.xml +++ b/android_app/app/src/main/res/values-de/strings.xml @@ -36,7 +36,10 @@ Körpergröße Kommentar Datum - Tage + + %d Tag + %d Tage + Tage übrig Löschen Alles löschen diff --git a/android_app/app/src/main/res/values-es/strings.xml b/android_app/app/src/main/res/values-es/strings.xml index aa468726..81621e74 100644 --- a/android_app/app/src/main/res/values-es/strings.xml +++ b/android_app/app/src/main/res/values-es/strings.xml @@ -38,7 +38,10 @@ Masa ósea Asignación inteligente de usuario - días + + %d día + %d días + medidas Últimos 7 días Últimos 30 días diff --git a/android_app/app/src/main/res/values-fr/strings.xml b/android_app/app/src/main/res/values-fr/strings.xml index 35cd961f..8988b076 100644 --- a/android_app/app/src/main/res/values-fr/strings.xml +++ b/android_app/app/src/main/res/values-fr/strings.xml @@ -33,7 +33,10 @@ Rapport taille-hanches Affectation intelligente de l\'Utilisateur - jours + + %d jour + %d jours + mesures 7 derniers jours 30 derniers jours diff --git a/android_app/app/src/main/res/values-ja/strings.xml b/android_app/app/src/main/res/values-ja/strings.xml index fd95cb3f..829998e8 100644 --- a/android_app/app/src/main/res/values-ja/strings.xml +++ b/android_app/app/src/main/res/values-ja/strings.xml @@ -23,7 +23,9 @@ 身長 キャンセル コメント - + + %d 日 + 期日 デリート レコードのエクスポート diff --git a/android_app/app/src/main/res/values-pl/strings.xml b/android_app/app/src/main/res/values-pl/strings.xml index 56228709..6cbae2b5 100644 --- a/android_app/app/src/main/res/values-pl/strings.xml +++ b/android_app/app/src/main/res/values-pl/strings.xml @@ -36,7 +36,9 @@ Masa kostna Inteligente przypisywanie użytkowników - dni + + %d dni + pomiarów Ostatnie 7 dni Ostatnie 30 dni diff --git a/android_app/app/src/main/res/values-pt/strings.xml b/android_app/app/src/main/res/values-pt/strings.xml index 962d17b4..733f1acd 100644 --- a/android_app/app/src/main/res/values-pt/strings.xml +++ b/android_app/app/src/main/res/values-pt/strings.xml @@ -69,7 +69,9 @@ Cancelar Comentário Data - dias + + %d dias + Dias restantes Deletar Deletar tudo diff --git a/android_app/app/src/main/res/values-sk/strings.xml b/android_app/app/src/main/res/values-sk/strings.xml index 9a7b7292..c24f70cb 100644 --- a/android_app/app/src/main/res/values-sk/strings.xml +++ b/android_app/app/src/main/res/values-sk/strings.xml @@ -31,7 +31,9 @@ Pomer pásu a bokov Hmotnosť kostí Chytré priradenie používateľa - dni + + %d dni + merania Posledných 7 dní Posledných 30 dní diff --git a/android_app/app/src/main/res/values-sv/strings.xml b/android_app/app/src/main/res/values-sv/strings.xml index fc6c5c62..6e44683e 100644 --- a/android_app/app/src/main/res/values-sv/strings.xml +++ b/android_app/app/src/main/res/values-sv/strings.xml @@ -60,7 +60,10 @@ Dagar kvar Måldatum är Viktskillnad - dagar + + %d dag + %d dagar + mätningar Senast 7 dagarna Senast 30 dagarna diff --git a/android_app/app/src/main/res/values-tr/strings.xml b/android_app/app/src/main/res/values-tr/strings.xml index f7fea94b..efb1415b 100644 --- a/android_app/app/src/main/res/values-tr/strings.xml +++ b/android_app/app/src/main/res/values-tr/strings.xml @@ -37,7 +37,9 @@ Kemik kütlesi Akýllý kullanýcý atamasý - Günler + + %d Günler + Ölçüler Son 7 Gün Son 30 Gün diff --git a/android_app/app/src/main/res/values/strings.xml b/android_app/app/src/main/res/values/strings.xml index 5d2baf0d..d4177fa8 100644 --- a/android_app/app/src/main/res/values/strings.xml +++ b/android_app/app/src/main/res/values/strings.xml @@ -38,7 +38,10 @@ Bone mass Smart User assignment - days + + %d day + %d days + measures Last 7 days Last 30 days From 90f4d9701b7f69081055609e15dc93ec2c6ee8a7 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Fri, 29 Dec 2017 22:16:52 +0100 Subject: [PATCH 2/5] Add support for writing unit tests --- .travis.yml | 2 +- android_app/app/build.gradle | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d4f958ff..465536bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,4 @@ after_success: - chmod +x ./upload_apk.sh - ./upload_apk.sh -script: cd android_app && ./gradlew assembleDebug +script: cd android_app && ./gradlew -i testDebugUnitTest assembleDebug diff --git a/android_app/app/build.gradle b/android_app/app/build.gradle index 291ecff2..3fd5e2b1 100644 --- a/android_app/app/build.gradle +++ b/android_app/app/build.gradle @@ -31,4 +31,6 @@ dependencies { compile "com.android.support:support-v4:${supportLibVersion}" compile "com.android.support:appcompat-v7:${supportLibVersion}" compile 'com.github.lecho:hellocharts-library:1.5.8@aar' + + testCompile 'junit:junit:4.12' } From 37588de24bad4e9666d9ec9ffa2904d8cc282291 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Fri, 29 Dec 2017 22:47:29 +0100 Subject: [PATCH 3/5] Move daysBetween to a separate class and add tests Also change the behaviour to the previous one were the time is ignored and only the date is used to calculate number of days between two dates. --- .../openscale/core/utils/DateTimeHelpers.java | 42 ++++++++++ .../gui/fragments/OverviewFragment.java | 13 ++-- .../gui/fragments/StatisticsFragment.java | 10 +-- .../core/utils/DateTimeHelpersTest.java | 78 +++++++++++++++++++ 4 files changed, 130 insertions(+), 13 deletions(-) create mode 100644 android_app/app/src/main/java/com/health/openscale/core/utils/DateTimeHelpers.java create mode 100644 android_app/app/src/test/java/com/health/openscale/core/utils/DateTimeHelpersTest.java diff --git a/android_app/app/src/main/java/com/health/openscale/core/utils/DateTimeHelpers.java b/android_app/app/src/main/java/com/health/openscale/core/utils/DateTimeHelpers.java new file mode 100644 index 00000000..6017019d --- /dev/null +++ b/android_app/app/src/main/java/com/health/openscale/core/utils/DateTimeHelpers.java @@ -0,0 +1,42 @@ +/* Copyright (C) 2017 Erik Johansson +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +*/ + +package com.health.openscale.core.utils; + +import java.util.Calendar; + +public final class DateTimeHelpers { + static public int daysBetween(Calendar start, Calendar end) { + if (start.after(end)) { + return -daysBetween(end, start); + } + + int days = 0; + + Calendar current = (Calendar)start.clone(); + while (current.get(Calendar.YEAR) < end.get(Calendar.YEAR)) { + final int daysInYear = + current.getActualMaximum(Calendar.DAY_OF_YEAR) + - current.get(Calendar.DAY_OF_YEAR) + 1; + days += daysInYear; + current.add(Calendar.DAY_OF_YEAR, daysInYear); + } + + days += end.get(Calendar.DAY_OF_YEAR) - current.get(Calendar.DAY_OF_YEAR); + + return days; + } +} diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java index 9cac71a3..61396f16 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java @@ -37,6 +37,7 @@ import com.health.openscale.R; import com.health.openscale.core.OpenScale; import com.health.openscale.core.datatypes.ScaleData; import com.health.openscale.core.datatypes.ScaleUser; +import com.health.openscale.core.utils.DateTimeHelpers; import com.health.openscale.gui.activities.DataEntryActivity; import com.health.openscale.gui.views.BMIMeasurementView; import com.health.openscale.gui.views.BMRMeasurementView; @@ -54,6 +55,7 @@ import com.health.openscale.gui.views.WeightMeasurementView; import java.text.DateFormat; import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; import java.util.List; @@ -255,7 +257,8 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener max_i = scaleDataList.size(); } - Date now = new Date(); + final Calendar now = Calendar.getInstance(); + Calendar histCalendar = Calendar.getInstance(); scaleDataLastDays = new ArrayList(); @@ -280,7 +283,8 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener if (histData.getBone() != 0.0f) valuesBone.add(new PointValue(i, histData.getBone())); - int days = daysBetween(now, histData.getDateTime()); + histCalendar.setTime(histData.getDateTime()); + int days = DateTimeHelpers.daysBetween(now, histCalendar); String label = getResources().getQuantityString(R.plurals.label_days, Math.abs(days), days); axisValues.add(new AxisValue(i, label.toCharArray())); } @@ -421,11 +425,6 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener pieChartLast.setPieChartData(pieChartData); } - private int daysBetween(Date startDate, Date endDate) { - final float msPerDay = 24 * 60 * 60 * 1000; - return Math.round((endDate.getTime() - startDate.getTime()) / msPerDay); - } - public void btnOnClickInsertData() { Intent intent = new Intent(overviewView.getContext(), DataEntryActivity.class); diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java index f4c6aad3..d7831157 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java @@ -30,6 +30,7 @@ import com.health.openscale.R; import com.health.openscale.core.OpenScale; import com.health.openscale.core.datatypes.ScaleData; import com.health.openscale.core.datatypes.ScaleUser; +import com.health.openscale.core.utils.DateTimeHelpers; import java.text.DateFormat; import java.util.ArrayList; @@ -114,7 +115,9 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen double weight_diff = goalScaleData.getConvertedWeight(currentScaleUser.scale_unit) - lastScaleData.getConvertedWeight(currentScaleUser.scale_unit); txtGoalDiff.setText(String.format("%.1f " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit], weight_diff)); - int days = Math.max(0, daysBetween(new Date(), currentScaleUser.goal_date)); + Calendar goalCalendar = Calendar.getInstance(); + goalCalendar.setTime(currentScaleUser.goal_date); + int days = Math.max(0, DateTimeHelpers.daysBetween(Calendar.getInstance(), goalCalendar)); txtGoalDayLeft.setText(getResources().getQuantityString(R.plurals.label_days, days, days)); lastScaleData.setUserId(currentScaleUser.id); @@ -330,9 +333,4 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen txtAvgWeek.setText(weekSize + " " + getResources().getString(R.string.label_measures)); txtAvgMonth.setText(monthSize + " " + getResources().getString(R.string.label_measures)); } - - private int daysBetween(Date startDate, Date endDate) { - final float msPerDay = 24 * 60 * 60 * 1000; - return (int)Math.ceil((endDate.getTime() - startDate.getTime()) / msPerDay); - } } diff --git a/android_app/app/src/test/java/com/health/openscale/core/utils/DateTimeHelpersTest.java b/android_app/app/src/test/java/com/health/openscale/core/utils/DateTimeHelpersTest.java new file mode 100644 index 00000000..c525110a --- /dev/null +++ b/android_app/app/src/test/java/com/health/openscale/core/utils/DateTimeHelpersTest.java @@ -0,0 +1,78 @@ +/* Copyright (C) 2017 Erik Johansson +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +*/ + +package com.health.openscale.core.utils; + +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.*; + +public class DateTimeHelpersTest { + Calendar getDate(int year, int month, int day, int hour, int minute, int second, int ms) { + Calendar cal = Calendar.getInstance(); + cal.set(year, month - 1, day, hour, minute, second); + cal.set(Calendar.MILLISECOND, ms); + return cal; + } + Calendar getDate(int year, int month, int day) { + return getDate(year, month, day, 0, 0, 0, 0); + } + + @Test + public void daysBetween() throws Exception { + assertEquals(0, + DateTimeHelpers.daysBetween( + getDate(2017, 1, 1), + getDate(2017, 1, 1))); + + assertEquals(0, + DateTimeHelpers.daysBetween( + getDate(2017, 1, 1, 12, 10, 10, 0), + getDate(2017, 1, 1, 12, 9, 0, 0))); + + assertEquals(0, + DateTimeHelpers.daysBetween( + getDate(2017, 1, 1, 23, 59, 59, 999), + getDate(2017, 1, 1))); + + assertEquals(1, + DateTimeHelpers.daysBetween( + getDate(2017, 1, 1), + getDate(2017, 1, 2))); + + assertEquals(-1, + DateTimeHelpers.daysBetween( + getDate(2017, 1, 2), + getDate(2017, 1, 1))); + + assertEquals(1, + DateTimeHelpers.daysBetween( + getDate(2017, 1, 1, 23, 59, 59, 999), + getDate(2017, 1, 2))); + + assertEquals(29 - 10 + 4 * 30 + 6 * 31 + 2, + DateTimeHelpers.daysBetween( + getDate(2016, 2, 10, 1, 2, 3, 10), + getDate(2017, 1, 2))); + + assertEquals(1 + 365 + 366, + DateTimeHelpers.daysBetween( + getDate(2014, 12, 31), + getDate(2017, 1, 1))); + } +} From ef74c7acd69e76c4edfbac6f5cae103812062ee9 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Fri, 29 Dec 2017 23:36:55 +0100 Subject: [PATCH 4/5] Lower build verbosity on travis while still showing failed tests. --- .travis.yml | 2 +- android_app/app/build.gradle | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 465536bf..371ee3e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,4 @@ after_success: - chmod +x ./upload_apk.sh - ./upload_apk.sh -script: cd android_app && ./gradlew -i testDebugUnitTest assembleDebug +script: cd android_app && ./gradlew testDebug assembleDebug diff --git a/android_app/app/build.gradle b/android_app/app/build.gradle index 3fd5e2b1..1676bcdb 100644 --- a/android_app/app/build.gradle +++ b/android_app/app/build.gradle @@ -34,3 +34,11 @@ dependencies { testCompile 'junit:junit:4.12' } + +tasks.withType(Test) { + testLogging { + exceptionFormat "full" + events "started", "skipped", "passed", "failed" + showStandardStreams true + } +} From f3e5174fcca5359893c73c1f5ff42505c7c21318 Mon Sep 17 00:00:00 2001 From: OliE Date: Sat, 30 Dec 2017 10:14:17 +0100 Subject: [PATCH 5/5] moved the junit test into an own package --- android_app/app/build.gradle | 3 +-- .../com/health/openscale/junit}/DateTimeHelpersTest.java | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) rename android_app/app/src/{test/java/com/health/openscale/core/utils => main/java/com/health/openscale/junit}/DateTimeHelpersTest.java (94%) diff --git a/android_app/app/build.gradle b/android_app/app/build.gradle index 1676bcdb..b6f97e31 100644 --- a/android_app/app/build.gradle +++ b/android_app/app/build.gradle @@ -31,8 +31,7 @@ dependencies { compile "com.android.support:support-v4:${supportLibVersion}" compile "com.android.support:appcompat-v7:${supportLibVersion}" compile 'com.github.lecho:hellocharts-library:1.5.8@aar' - - testCompile 'junit:junit:4.12' + compile 'junit:junit:4.12' } tasks.withType(Test) { diff --git a/android_app/app/src/test/java/com/health/openscale/core/utils/DateTimeHelpersTest.java b/android_app/app/src/main/java/com/health/openscale/junit/DateTimeHelpersTest.java similarity index 94% rename from android_app/app/src/test/java/com/health/openscale/core/utils/DateTimeHelpersTest.java rename to android_app/app/src/main/java/com/health/openscale/junit/DateTimeHelpersTest.java index c525110a..2e626c14 100644 --- a/android_app/app/src/test/java/com/health/openscale/core/utils/DateTimeHelpersTest.java +++ b/android_app/app/src/main/java/com/health/openscale/junit/DateTimeHelpersTest.java @@ -14,13 +14,15 @@ * along with this program. If not, see */ -package com.health.openscale.core.utils; +package com.health.openscale.junit; + +import com.health.openscale.core.utils.DateTimeHelpers; import org.junit.Test; import java.util.Calendar; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; public class DateTimeHelpersTest { Calendar getDate(int year, int month, int day, int hour, int minute, int second, int ms) {