DateResolutionFormatter { public static ZonedDateTime computeUpperDate(ZonedDateTime date, SearchQuery.DateResolution resolution) { return computeLowerDate(date, resolution).plus(1, convertDateResolutionField(resolution)); }  static ZonedDateTime computeUpperDate(ZonedDateTime date, SearchQuery.DateResolution resolution); static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution); static ZonedDateTime convertDateToZonedDateTime(Date date);  }
@Test void calculateUpperDateShouldReturnDateUpToTheNextMinuteUsingMinuteUnit() { assertThat(DateResolutionFormatter.computeUpperDate(date, SearchQuery.DateResolution.Minute)) .isEqualTo("2014-01-02T15:16:00Z"); }
@Test void calculateUpperDateShouldReturnDateUpToTheNextHourUsingHourUnit() { assertThat(DateResolutionFormatter.computeUpperDate(date, SearchQuery.DateResolution.Hour)) .isEqualTo("2014-01-02T16:00:00Z"); }
@Test void calculateUpperDateShouldReturnDateUpToTheNextMonthUsingMonthUnit() { assertThat(DateResolutionFormatter.computeUpperDate(date, SearchQuery.DateResolution.Month)) .isEqualTo("2014-02-01T00:00:00Z"); }
@Test void calculateUpperDateShouldReturnDateUpToTheNextYearUsingYearUnit() { assertThat(DateResolutionFormatter.computeUpperDate(date, SearchQuery.DateResolution.Year)) .isEqualTo("2015-01-01T00:00:00Z"); }
@Test void calculateUpperDateShouldReturnDateUpToTheNextDayUsingDayUnit() { assertThat(DateResolutionFormatter.computeUpperDate(date, SearchQuery.DateResolution.Day)) .isEqualTo("2014-01-03T00:00:00Z"); }