[RM] Bug Sailfish-core > Fix testGetDate and testBusinessGetDate
@@ -641,11 +641,23 @@ public class TestDateUtil {
}
modified = dateUtil.getDateTime("D-" + toSaturdayDown + timePattern, true);
+ if (toSaturday != 0) {
assertEquals(modified.getDayOfWeek(), DayOfWeek.FRIDAY);
assertEquals(toSaturdayDown + 1, ChronoUnit.DAYS.between(modified, currentDate));
+ }
+ else {
+ assertEquals(modified.getDayOfWeek(), DayOfWeek.MONDAY);
+ assertEquals(toSaturdayDown -2, ChronoUnit.DAYS.between(modified, currentDate));
+
+ }
modified = dateUtil.getDateTime("D-" + toSundayDown + timePattern, true);
+ if (toSunday != 0) {
assertEquals(modified.getDayOfWeek(), DayOfWeek.FRIDAY);
+ }
+ else {
+ assertEquals(modified.getDayOfWeek(), DayOfWeek.MONDAY);
+ }
assertEquals(toSundayDown + 2, ChronoUnit.DAYS.between(modified, currentDate));
// subtract without skipping
@@ -720,7 +732,7 @@ public class TestDateUtil {
LocalDateTime modified = dateUtil.getBusinessDateTime("D+" + toSaturday + timePattern);
assertEquals(modified.getDayOfWeek(), expected);
- expected = toSunday == 0 ? DayOfWeek.FRIDAY : DayOfWeek.TUESDAY;
+ expected = toSunday == 0 ? DayOfWeek.MONDAY : DayOfWeek.TUESDAY;
modified = dateUtil.getBusinessDateTime("D+" + toSunday + timePattern);
assertEquals(modified.getDayOfWeek(), expected);
