### Question:
OSHGetResultEnvoy extends AbstractOSHEnvoy { static String getTimeString(TimeSpan timeSpan) { String timeString; if (timeSpan.isZero() || timeSpan.isTimeless()) { timeString = "now"; } else if (timeSpan.isUnboundedStart()) { timeString = "now/" + DateTimeUtilities.generateISO8601DateString(timeSpan.getEndDate()); } else if (timeSpan.isUnboundedEnd()) { timeString = DateTimeUtilities.generateISO8601DateString(timeSpan.getStartDate()) + "/now"; } else if (timeSpan.isInstantaneous()) { timeString = DateTimeUtilities.generateISO8601DateString(timeSpan.getStartDate()); } else { timeString = timeSpan.toISO8601String(); } return timeString; } OSHGetResultEnvoy(Toolbox toolbox); @Override boolean providesDataFor(DataModelCategory category); @Override void query(DataModelCategory category, Collection<? extends Satisfaction> satisfactions,
            List<? extends PropertyMatcher<?>> parameters, List<? extends OrderSpecifier> orderSpecifiers, int limit,
            Collection<? extends PropertyDescriptor<?>> propertyDescriptors, CacheDepositReceiver queryReceiver);  }### Answer:
@Test public void testGetTimeString() { SimpleDateFormat format = new SimpleDateFormat(DateTimeFormats.DATE_FORMAT); try { Assert.assertEquals("2013-04-09T00:00:00Z", OSHGetResultEnvoy.getTimeString(TimeSpan.get(DateTimeUtilities.parse(format, "2013-04-09")))); Assert.assertEquals("now", OSHGetResultEnvoy.getTimeString(TimeSpan.ZERO)); Assert.assertEquals("now", OSHGetResultEnvoy.getTimeString(TimeSpan.TIMELESS)); Assert.assertEquals("2013-04-09T00:00:00Z/2013-04-10T00:00:00Z", OSHGetResultEnvoy.getTimeString( TimeSpan.get(DateTimeUtilities.parse(format, "2013-04-09"), DateTimeUtilities.parse(format, "2013-04-10")))); Assert.assertEquals("2013-04-09T00:00:00Z/now", OSHGetResultEnvoy .getTimeString(TimeSpan.newUnboundedEndTimeSpan(DateTimeUtilities.parse(format, "2013-04-09")))); Assert.assertEquals("now/2013-04-09T00:00:00Z", OSHGetResultEnvoy .getTimeString(TimeSpan.newUnboundedStartTimeSpan(DateTimeUtilities.parse(format, "2013-04-09")))); } catch (ParseException e) { Assert.fail(e.getMessage()); } }