Skip to content

Commit

Permalink
Merge pull request #922 from opensrp/change-sync-service-modifier
Browse files Browse the repository at this point in the history
Update doSync method access
  • Loading branch information
hamza-vd authored Aug 10, 2023
2 parents 2b50eaf + a84599d commit 4fcf06c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected void handleSync() {
doSync();
}

private void doSync() {
protected void doSync() {
if (!NetworkUtils.isNetworkAvailable()) {
complete(FetchStatus.noConnection);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 4fcf06c

Please sign in to comment.