Skip to content

Commit

Permalink
fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
Balcan committed Dec 12, 2024
1 parent d99550b commit e5d89c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
16 changes: 7 additions & 9 deletions app/src/main/java/org/dhis2/utils/customviews/DateDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
8 changes: 3 additions & 5 deletions app/src/test/java/org/dhis2/utils/DateUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e5d89c9

Please sign in to comment.