From e5d89c9f2c17d596b799f5e2a67844cb58f7db9d Mon Sep 17 00:00:00 2001 From: Pablo Pajuelo Cabezas Date: Thu, 12 Dec 2024 07:52:06 +0100 Subject: [PATCH] fix code smells --- .../org/dhis2/utils/customviews/DateDialog.java | 16 +++++++--------- .../test/java/org/dhis2/utils/DateUtilsTest.java | 8 +++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/dhis2/utils/customviews/DateDialog.java b/app/src/main/java/org/dhis2/utils/customviews/DateDialog.java index d7da3ae9af..bbe6d26087 100644 --- a/app/src/main/java/org/dhis2/utils/customviews/DateDialog.java +++ b/app/src/main/java/org/dhis2/utils/customviews/DateDialog.java @@ -130,15 +130,13 @@ private void manageButtonPeriods(boolean next) { activity, fromToSelector, true, - () -> { - disposable.add(new RxDateDialog((ActivityGlobalAbstract) requireActivity(), Period.WEEKLY) - .createForFilter().show() - .subscribe( - periods -> fromToSelector.onFromToSelected(new ArrayList<>()), - Timber::d - ) - ); - } + () -> disposable.add(new RxDateDialog((ActivityGlobalAbstract) requireActivity(), Period.WEEKLY) + .createForFilter().show() + .subscribe( + periods -> fromToSelector.onFromToSelected(new ArrayList<>()), + Timber::d + ) + ) ); dismiss(); } diff --git a/app/src/test/java/org/dhis2/utils/DateUtilsTest.java b/app/src/test/java/org/dhis2/utils/DateUtilsTest.java index 6f36b07b27..0ae2ce1101 100644 --- a/app/src/test/java/org/dhis2/utils/DateUtilsTest.java +++ b/app/src/test/java/org/dhis2/utils/DateUtilsTest.java @@ -6,8 +6,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import android.util.Log; - import org.dhis2.R; import org.dhis2.bindings.StringExtensionsKt; import org.dhis2.commons.date.DateUtils; @@ -644,7 +642,7 @@ public void isInputPeriodDateInsideFutureOpenDayConfiguration() throws ParseExce DateUtils.oldUiDateFormat().parse("2022-11-05") ); - assertEquals(true, DateUtils.getInstance().isInsideFutureInputPeriod(inputPeriod.endPeriodDate(), 5)); + assertTrue(DateUtils.getInstance().isInsideFutureInputPeriod(inputPeriod.endPeriodDate(), 5)); } @Test @@ -659,7 +657,7 @@ public void isInputPeriodDateOutsideFutureOpenDayConfiguration() throws ParseExc DateUtils.oldUiDateFormat().parse("2022-11-15") ); - assertEquals(false, DateUtils.getInstance().isInsideFutureInputPeriod(inputPeriod.endPeriodDate(), 5)); + assertFalse(DateUtils.getInstance().isInsideFutureInputPeriod(inputPeriod.endPeriodDate(), 5)); } @Test @@ -673,7 +671,7 @@ public void isFutureInputPeriodsNotConfigured() { new Date() ); - assertEquals(false, DateUtils.getInstance().isInsideFutureInputPeriod(inputPeriod.endPeriodDate(), 0)); + assertFalse(DateUtils.getInstance().isInsideFutureInputPeriod(inputPeriod.endPeriodDate(), 0)); } @Test