summaryrefslogtreecommitdiffstats
path: root/dmi-stub/dmi-stub-service/src/test/groovy
diff options
context:
space:
mode:
authorSourabh Sourabh <sourabh.sourabh@est.tech>2024-11-21 10:27:25 +0000
committerSourabh Sourabh <sourabh.sourabh@est.tech>2024-11-21 10:27:25 +0000
commitb5d7b53351a0d3f1f0b30665a8e86bf3c8026aa7 (patch)
tree4520cf3d4b3d5e6bb1ef5e8b9cd87136011aa9dd /dmi-stub/dmi-stub-service/src/test/groovy
parent726bc9b79335022f5e4174454972dee7f563a1c3 (diff)
Revert "[DMI] Fix for DMI merge master Job"HEADmaster
This reverts commit 726bc9b79335022f5e4174454972dee7f563a1c3. Issue-ID: CPS-2499 Reason for revert: Merge master job is still failing Change-Id: Id5331489f88e8e0c2f90e6c96c306d990d19293e Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'dmi-stub/dmi-stub-service/src/test/groovy')
-rw-r--r--dmi-stub/dmi-stub-service/src/test/groovy/org/onap/cps/ncmp/dmi/rest/stub/utils/EventDateTimeFormatterSpec.groovy27
1 files changed, 27 insertions, 0 deletions
diff --git a/dmi-stub/dmi-stub-service/src/test/groovy/org/onap/cps/ncmp/dmi/rest/stub/utils/EventDateTimeFormatterSpec.groovy b/dmi-stub/dmi-stub-service/src/test/groovy/org/onap/cps/ncmp/dmi/rest/stub/utils/EventDateTimeFormatterSpec.groovy
new file mode 100644
index 00000000..9e229127
--- /dev/null
+++ b/dmi-stub/dmi-stub-service/src/test/groovy/org/onap/cps/ncmp/dmi/rest/stub/utils/EventDateTimeFormatterSpec.groovy
@@ -0,0 +1,27 @@
+package org.onap.cps.ncmp.dmi.rest.stub.utils;
+
+import spock.lang.Specification
+
+import java.time.Year
+
+class EventDateTimeFormatterSpec extends Specification {
+
+ def 'Get ISO formatted date and time.' () {
+ expect: 'iso formatted date and time starts with current year'
+ assert EventDateTimeFormatter.getCurrentIsoFormattedDateTime().startsWith(String.valueOf(Year.now()))
+ }
+
+ def 'Convert date time from string to OffsetDateTime type.'() {
+ when: 'date time as a string is converted to OffsetDateTime type'
+ def result = EventDateTimeFormatter.toIsoOffsetDateTime('2024-05-28T18:28:02.869+0100')
+ then: 'the result convert back back to a string is the same as the original timestamp (except the format of timezone offset)'
+ assert result.toString() == '2024-05-28T18:28:02.869+01:00'
+ }
+
+ def 'Convert blank string.' () {
+ expect: 'converting a blank string result in null'
+ assert EventDateTimeFormatter.toIsoOffsetDateTime(' ') == null
+ }
+
+}
+