@Test public void startTimeToDayIndex_FirstDay_ReturnsZero() { // Given a start time 1 hour after the start of the conference long startTime = Config.CONFERENCE_START_MILLIS + TimeUtils.HOUR * 1; // When getting the day index for the start time int index = UIUtils.startTimeToDayIndex(startTime); // Then the index is 0 assertThat(index, is(0)); }
@Test public void startTimeToDayIndex_BeforeStart_ReturnsZero() { // Given a start time 24 hours before the start of the conference long startTime = Config.CONFERENCE_START_MILLIS - TimeUtils.HOUR * 24; // When getting the day index for the start time int index = UIUtils.startTimeToDayIndex(startTime); // Then the index is 0 assertThat(index, is(0)); }
@Test public void startTimeToDayIndex_AfterEnd_ReturnsLastDay() { // Given a start time 24 hours after the start of the conference long startTime = Config.CONFERENCE_END_MILLIS + TimeUtils.HOUR * 24; // When getting the day index for the start time int index = UIUtils.startTimeToDayIndex(startTime); // Then the index is the last day of the conference int lastDay = Config.CONFERENCE_DAYS.length - 1; assertThat(index, is(lastDay)); }
@Test public void startTimeToDayIndex_OneHourBeforeStartOfLastDay_ReturnsZero() { // Given a start time 1 hour before the start of the last day of the conference long startTime = Config.CONFERENCE_DAYS[Config.CONFERENCE_DAYS.length - 1][0] - TimeUtils.HOUR * 1; // When getting the day index for the start time int index = UIUtils.startTimeToDayIndex(startTime); // Then the index is 0 assertThat(index, is(0)); }