diff --git a/omniNotes/src/test/java/it/feio/android/omninotes/utils/date/DateUtilsTest.java b/omniNotes/src/test/java/it/feio/android/omninotes/utils/date/DateUtilsTest.java index aec4d0c7a..964b0f827 100644 --- a/omniNotes/src/test/java/it/feio/android/omninotes/utils/date/DateUtilsTest.java +++ b/omniNotes/src/test/java/it/feio/android/omninotes/utils/date/DateUtilsTest.java @@ -28,8 +28,6 @@ import java.util.Locale; import org.junit.Assert; import org.junit.Test; -import org.mockito.MockedStatic; -import org.mockito.Mockito; public class DateUtilsTest { @@ -55,15 +53,23 @@ public void prettyTime() { Assert.assertEquals(0, prettyTime.toLowerCase().length()); } + @Test + public void getNextMinute() { + var nextMinute = DateUtils.getNextMinute(); + + assertTrue(Calendar.getInstance().getTimeInMillis() < nextMinute); + assertTrue(nextMinute < Calendar.getInstance().getTimeInMillis() + 61 * 1000); + } + @Test public void getPresetReminder() { - long mockedNextMinute = 1497315847L; - Long testReminder = null; - try (MockedStatic dateUtils = Mockito.mockStatic(DateUtils.class)) { - dateUtils.when(DateUtils::getNextMinute).thenReturn(mockedNextMinute); + var nextHour = Calendar.getInstance().getTimeInMillis() + 60 * 60 * 1000; + assertEquals(nextHour, DateUtils.getPresetReminder(nextHour)); - assertEquals(mockedNextMinute, DateUtils.getPresetReminder(testReminder)); - } + var previousMinute = Calendar.getInstance().getTimeInMillis() - 60 * 1000; + var nextMinute = Calendar.getInstance().getTimeInMillis() + 61 * 1000; + var presetReminder = DateUtils.getPresetReminder(previousMinute); + assertTrue(Calendar.getInstance().getTimeInMillis() < presetReminder && presetReminder < nextMinute); } @Test