DateTimeParameterValue extends AbstractParameterValue { @Override public String getQueryString() { return "\"" + (value instanceof Date ? ((Date) value).toInstant() : value) + "\"^^<" + XSD.DATETIME + ">"; } DateTimeParameterValue(Object value); @Override Object getValue(); @Override String getQueryString();  }
@Test void getQueryStringReturnsISOFormatDateTimeForLocalDateTime() { final LocalDateTime value = LocalDateTime.now(); final DateTimeParameterValue sut = new DateTimeParameterValue(value); final String expected = "\"" + value + "\"^^<" + XSD.DATETIME + ">"; assertEquals(expected, sut.getQueryString()); }
@Test void getQueryStringReturnsISOFormatDateTimeForZonedDateTime() { final OffsetDateTime value = OffsetDateTime.now(); final DateTimeParameterValue sut = new DateTimeParameterValue(value); final String expected = "\"" + value + "\"^^<" + XSD.DATETIME + ">"; assertEquals(expected, sut.getQueryString()); }
@Test void getQueryStringReturnsISOFormatDateTimeForInstant() { final Instant value = Instant.now(); final DateTimeParameterValue sut = new DateTimeParameterValue(value); final String expected = "\"" + value + "\"^^<" + XSD.DATETIME + ">"; assertEquals(expected, sut.getQueryString()); }
@Test void getQueryStringReturnsISOFormatDateTimeForDate() { final Date value = new Date(); final DateTimeParameterValue sut = new DateTimeParameterValue(value); final String expected = "\"" + value.toInstant() + "\"^^<" + XSD.DATETIME + ">"; assertEquals(expected, sut.getQueryString()); }