Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doSync method access #922

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}

Loading