From e834c9345da1819613044c423d6cd3a096aad55e Mon Sep 17 00:00:00 2001 From: mpriyank Date: Fri, 3 May 2024 13:45:03 +0100 Subject: [BUG] Correctly parse observedTimestamp - Using the DateTimeUtility to parse the passed OffsetDateTime and using it for conversion to string - Moving to actual src/main/java from test side as it is to be used in the prod code as well and only keeping the methods in use. - Added test to fix the coverage issue Issue-ID: CPS-2211 Change-Id: I2b4325bb77a6da7fd470986b1da293f455650375 Signed-off-by: mpriyank --- cps-rest/src/test/java/org/onap/cps/utils/DateTimeUtility.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cps-rest') diff --git a/cps-rest/src/test/java/org/onap/cps/utils/DateTimeUtility.java b/cps-rest/src/test/java/org/onap/cps/utils/DateTimeUtility.java index f8d709647c..af0efe2e21 100644 --- a/cps-rest/src/test/java/org/onap/cps/utils/DateTimeUtility.java +++ b/cps-rest/src/test/java/org/onap/cps/utils/DateTimeUtility.java @@ -30,11 +30,11 @@ public interface DateTimeUtility { DateTimeFormatter ISO_TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern(ISO_TIMESTAMP_PATTERN); static OffsetDateTime toOffsetDateTime(String datetTimestampAsString) { - return ! StringUtils.hasLength(datetTimestampAsString) - ? null : OffsetDateTime.parse(datetTimestampAsString, ISO_TIMESTAMP_FORMATTER); + return !StringUtils.hasLength(datetTimestampAsString) ? null + : OffsetDateTime.parse(datetTimestampAsString, ISO_TIMESTAMP_FORMATTER); } static String toString(OffsetDateTime offsetDateTime) { return offsetDateTime != null ? ISO_TIMESTAMP_FORMATTER.format(offsetDateTime) : null; } -} +} \ No newline at end of file -- cgit 1.2.3-korg