### Question:
TemporalFunction { public static int getDayFromRange(ShardRange range) { Tuple min = range.getMinTuple(); Tuple max = range.getMaxTuple(); checkArgument(getOnlyElement(min.getTypes()).equals(getOnlyElement(max.getTypes())), "type of min and max is not same"); Type type = getOnlyElement(min.getTypes()); if (type.equals(DATE)) { return (int) getOnlyElement(min.getValues()); } if (type.equals(TIMESTAMP_MILLIS)) { long minValue = (long) getOnlyElement(min.getValues()); long maxValue = (long) getOnlyElement(max.getValues()); return determineDay(minValue, maxValue); } throw new IllegalArgumentException("Wrong type for shard range: " + type); } private  TemporalFunction(); static int getDay(Type type, Block block, int position); static int getDayFromRange(ShardRange range);  }### Answer:
@Test public void testDateShardRange() { assertEquals(TemporalFunction.getDayFromRange(dateRange(2, 2)), 2); assertEquals(TemporalFunction.getDayFromRange(dateRange(13, 13)), 13); assertEquals(TemporalFunction.getDayFromRange(dateRange(2, 5)), 2); }
@Test public void testTimestampShardRange() { assertEquals(TemporalFunction.getDayFromRange(timeRange(DATE_TIME.getMillis(), Duration.ofDays(1))), 1); assertEquals(TemporalFunction.getDayFromRange(timeRange(DATE_TIME.getMillis(), Duration.ofDays(2))), 2); assertEquals(TemporalFunction.getDayFromRange(timeRange(DATE_TIME.getMillis() + Duration.ofHours(11).toMillis(), Duration.ofHours(24))), 1); assertEquals(TemporalFunction.getDayFromRange(timeRange(DATE_TIME.getMillis() + Duration.ofHours(13).toMillis(), Duration.ofHours(24))), 2); }