Skip to content

Commit

Permalink
add extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KristianTashkov committed Sep 4, 2020
1 parent a5547fc commit a20d71e
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ public void testMillisecondsUntilTomorrow() throws Exception
assertThat(DateUtils.millisecondsUntilTomorrow(), equalTo(2 * HOUR_LENGTH + 30 * MINUTE_LENGTH));
}

@Test
public void testGetTodayWithOffset() throws Exception
{
assertThat(DateUtils.getTodayWithOffset(), equalTo(new Timestamp(FIXED_LOCAL_TIME)));
DateUtils.setStartDayOffset(9, 0);
assertThat(
DateUtils.getTodayWithOffset(),
equalTo(new Timestamp(FIXED_LOCAL_TIME - DAY_LENGTH)));
}

@Test
public void testGetStartOfDayWithOffset() throws Exception
{
long timestamp = unixTime(2020, SEPTEMBER, 3);
assertThat(
DateUtils.getStartOfDayWithOffset(timestamp + HOUR_LENGTH),
equalTo(timestamp));
DateUtils.setStartDayOffset(3, 30);
assertThat(
DateUtils.getStartOfDayWithOffset(timestamp + 3 * HOUR_LENGTH + 29 * MINUTE_LENGTH),
equalTo(timestamp - DAY_LENGTH));
}

@Test
public void test_applyTimezone()
{
Expand Down

0 comments on commit a20d71e

Please sign in to comment.