summaryrefslogtreecommitdiffstats
path: root/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/test
diff options
context:
space:
mode:
authoregernug <gerard.nugent@est.tech>2024-07-08 10:59:08 +0100
committeregernug <gerard.nugent@est.tech>2024-07-12 13:36:12 +0100
commite703e344507e0f224cffecb931a8075d4e94a50c (patch)
treea0b3c4b4b549a5ea554896fe8e21f7394b903c23 /dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/test
parent5e4eb8c3bd9886e4c3ee2089b54236a01a99566b (diff)
Relocation of DMI Stub to DMI Plugin
Move the DMI Stub into Plugin to use generated code classes Changes: -Created dmi-stub module -Changed dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml dependency from cps-ncmp-rest to cps-ncmp-events -Added extra required dependencies to dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml -Included EventDateTimeFormatter in dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/utils -Included dmi-stub in pom.xml Issue-ID: CPS-2145 Change-Id: Ibf0c9601564d3b38979c07c6a00d622cf763bf6b Signed-off-by: egernug <gerard.nugent@est.tech>
Diffstat (limited to 'dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/test')
-rw-r--r--dmi-stub/dmi-plugin-demo-and-csit-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-plugin-demo-and-csit-stub-service/src/test/groovy/org/onap/cps/ncmp/dmi/rest/stub/utils/EventDateTimeFormatterSpec.groovy b/dmi-stub/dmi-plugin-demo-and-csit-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-plugin-demo-and-csit-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
+ }
+
+}
+