### Question:
SolrQueryBuilder { public static String computeEnd(String end, Duration ttl) { return computeEnd(end, OffsetDateTime.now(ZoneOffset.UTC), ttl); } SolrQueryBuilder(); static String computeEnd(String end, Duration ttl); static String computeEnd(String end, OffsetDateTime now, Duration ttl); SolrQueryBuilder setQueryText(String queryText); SolrQueryBuilder setInterval(String startValue, String endValue); SolrQueryBuilder setFilterQueryText(String filterQueryText); SolrQueryBuilder setDocument(Document document); SolrQueryBuilder addSort(String... sortBy); SolrQuery build();  }### Answer:
@Test public void testComputeEndReturnsNullIsNoEndAndNoTTLWasGiven() { assertThat(computeEnd(null, OffsetDateTime.now(), null), Is.is(nullValue())); }
@Test public void testComputeEndReturnsEndIfOnlyEndWasGiven() { String end = "2018-10-09T10:11:12.000Z"; assertThat(computeEnd(end, OffsetDateTime.now(), null), Is.is(end)); }
@Test public void testComputeEndReturnsNowMinusTtlIfOnlyTtlWasGiven() { OffsetDateTime now = OffsetDateTime.of(2018, 10, 9, 10, 11, 12, 0, ZoneOffset.UTC); assertThat(computeEnd(null, now, Duration.ofDays(5)), Is.is("2018-10-04T10:11:12.000Z")); }
@Test public void testComputeEndReturnsEndIfBothWasGiven() { String end = "2018-10-09T10:11:12.000Z"; assertThat(computeEnd(end, OffsetDateTime.now(), Duration.ofDays(5)), Is.is(end)); }