-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [ANDROAPP-6644] check if scheduled event is overdue and test imp…
…lementation
- Loading branch information
1 parent
222e3d3
commit 054b4f2
Showing
8 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
commons/src/androidTest/java/org/dhis2/commons/date/DateUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.dhis2.commons.date; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import org.junit.Test; | ||
import java.util.Calendar; | ||
import java.util.Date; | ||
|
||
public class DateUtilsTest { | ||
|
||
|
||
@Test | ||
public void returnsEventOverDueDateCorrectly() { | ||
|
||
Calendar calendar = Calendar.getInstance(); | ||
//should return false for current date | ||
calendar.setTime(new Date()); | ||
assertEquals(false, DateUtils.getInstance().isEventDueDateOverdue(calendar.getTime())); | ||
//false for future date | ||
calendar.add(Calendar.DAY_OF_MONTH, 10); | ||
assertEquals(false, DateUtils.getInstance().isEventDueDateOverdue(calendar.getTime())); | ||
//true for past dates | ||
calendar.add(Calendar.DAY_OF_MONTH, -30); | ||
assertEquals(true, DateUtils.getInstance().isEventDueDateOverdue(calendar.getTime())); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters