diff --git a/gradle.properties b/gradle.properties index 04c2b281c..c869817a4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=6.1.3-SNAPSHOT +VERSION_NAME=6.1.4-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Core Application diff --git a/opensrp-core/src/main/java/org/smartregister/sync/intent/SyncIntentService.java b/opensrp-core/src/main/java/org/smartregister/sync/intent/SyncIntentService.java index 294a1bb41..4ed1366ae 100644 --- a/opensrp-core/src/main/java/org/smartregister/sync/intent/SyncIntentService.java +++ b/opensrp-core/src/main/java/org/smartregister/sync/intent/SyncIntentService.java @@ -115,7 +115,7 @@ protected void handleSync() { doSync(); } - private void doSync() { + protected void doSync() { if (!NetworkUtils.isNetworkAvailable()) { complete(FetchStatus.noConnection); return; diff --git a/opensrp-core/src/test/java/org/smartregister/util/DateUtilTest.java b/opensrp-core/src/test/java/org/smartregister/util/DateUtilTest.java index 325da95bb..0278189ca 100644 --- a/opensrp-core/src/test/java/org/smartregister/util/DateUtilTest.java +++ b/opensrp-core/src/test/java/org/smartregister/util/DateUtilTest.java @@ -4,6 +4,8 @@ import org.joda.time.DateTime; import org.joda.time.LocalDate; +import org.joda.time.LocalDateTime; +import org.joda.time.format.ISODateTimeFormat; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -95,4 +97,25 @@ public void differenceTest() { Assert.assertEquals(2, DateUtil.dayDifference(new LocalDate("2019-10-01"), new LocalDate("2019-10-03"))); Assert.assertEquals(1, DateUtil.weekDifference(new LocalDate("2019-09-26"), new LocalDate("2019-10-03"))); } + + @Test + public void testSetDefaultDateFormatShouldSSetTheDefaultDateFormatOfDateUtil() { + DateUtil.setDefaultDateFormat("yyyy/MM/dd"); + Assert.assertEquals("yyyy/MM/dd", DateUtil.DEFAULT_DATE_FORMAT); + } + + + @Test + public void testFormatFromISOString() { + String localDateTime = LocalDateTime.parse("22-09-23").toString(ISODateTimeFormat.dateTime()); + String date = DateUtil.formatFromISOString(localDateTime, "dd/MM/YY"); + Assert.assertEquals("23/09/22", date); + } + + @Test + public void testGetTimeFromMillis() { + LocalDate date = DateUtil.getDateFromMillis(1691654548L); + Assert.assertEquals("1970-01-20", date.toString()); + } } +