From b77fbc282e59422f043a02579648638c28677855 Mon Sep 17 00:00:00 2001 From: Madhavan Sridharan Date: Tue, 12 Dec 2023 13:30:31 -0500 Subject: [PATCH] Fix to data formatting error --- .../com/datastax/cdm/cql/codec/DATERANGETYPE_CodecTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/datastax/cdm/cql/codec/DATERANGETYPE_CodecTest.java b/src/test/java/com/datastax/cdm/cql/codec/DATERANGETYPE_CodecTest.java index 3c6f1faa..807d1495 100644 --- a/src/test/java/com/datastax/cdm/cql/codec/DATERANGETYPE_CodecTest.java +++ b/src/test/java/com/datastax/cdm/cql/codec/DATERANGETYPE_CodecTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import java.nio.ByteBuffer; import java.text.ParseException; -import java.time.Instant; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; import java.time.temporal.ChronoUnit; import static org.junit.jupiter.api.Assertions.*; @@ -108,10 +108,12 @@ void format_ShouldFormatDateRangeToString() throws ParseException { @Test void parse_ShouldParseStringToDateRange() throws ParseException { + DateTimeFormatter df = (new DateTimeFormatterBuilder()) + .appendInstant(3).toFormatter(); String formattedDateTime = ZonedDateTime.now() .withZoneSameInstant(ZoneOffset.UTC) .truncatedTo(ChronoUnit.MILLIS) - .format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + .format(df); // Enclose in single quotes as per the error message String dateRangeLiteral = "'" + formattedDateTime + "'";