summaryrefslogtreecommitdiffstats
path: root/models-base/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'models-base/src/test/java')
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java14
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java9
2 files changed, 12 insertions, 11 deletions
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java
index 12b9e3509..4865eb904 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceTimestampKeyTest.java
@@ -28,8 +28,8 @@ import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.sql.Timestamp;
import java.time.Instant;
+import java.util.Date;
import org.junit.Test;
public class PfReferenceTimestampKeyTest {
@@ -51,7 +51,7 @@ public class PfReferenceTimestampKeyTest {
assertEquals(LOCAL_NAME,
new PfReferenceTimestampKey(new PfReferenceKey(), LOCAL_NAME, Instant.ofEpochSecond(timeStamp))
.getReferenceKey().getLocalName());
- assertEquals(Timestamp.from(Instant.ofEpochSecond(timeStamp)), new PfReferenceTimestampKey(new PfConceptKey(),
+ assertEquals(Date.from(Instant.ofEpochSecond(timeStamp)), new PfReferenceTimestampKey(new PfConceptKey(),
PARENT_LOCAL_NAME, LOCAL_NAME, Instant.ofEpochSecond(timeStamp)).getTimeStamp());
assertThat(new PfReferenceTimestampKey("ParentKeyName", VERSION001, PARENT_LOCAL_NAME, LOCAL_NAME,
@@ -99,8 +99,8 @@ public class PfReferenceTimestampKeyTest {
testReferenceKey.getReferenceKey().setLocalName("LN");
assertEquals("LN", testReferenceKey.getReferenceKey().getLocalName());
- testReferenceKey.setTimeStamp(Timestamp.from(DEFAULT_TIMESTAMP));
- assertEquals(Timestamp.from(DEFAULT_TIMESTAMP), testReferenceKey.getTimeStamp());
+ testReferenceKey.setTimeStamp(Date.from(DEFAULT_TIMESTAMP));
+ assertEquals(Date.from(DEFAULT_TIMESTAMP), testReferenceKey.getTimeStamp());
assertThatThrownBy(() -> testReferenceKey.isCompatible(null))
@@ -116,7 +116,7 @@ public class PfReferenceTimestampKeyTest {
PfReferenceTimestampKey clonedReferenceKey = new PfReferenceTimestampKey(testReferenceKey);
- assertEquals("PfReferenceTimestampKey(timeStamp=" + Timestamp.from(Instant.EPOCH) + ","
+ assertEquals("PfReferenceTimestampKey(timeStamp=" + Date.from(Instant.EPOCH) + ","
+ " referenceKey=PfReferenceKey(parentKeyName=PKN, parentKeyVersion=0.0.1, "
+ "parentLocalName=ParentLocalName, localName=LN))", clonedReferenceKey.toString());
@@ -125,7 +125,7 @@ public class PfReferenceTimestampKeyTest {
assertEquals(testReferenceKey, clonedReferenceKey);
assertNotEquals(testReferenceKey, new PfReferenceTimestampKey("PKN", VERSION001, "PLN",
"LN", Instant.ofEpochSecond(timeStamp)));
- testReferenceKey.setTimeStamp(Timestamp.from(Instant.ofEpochSecond(timeStamp)));
+ testReferenceKey.setTimeStamp(Date.from(Instant.ofEpochSecond(timeStamp)));
assertEquals(testReferenceKey, new PfReferenceTimestampKey("PKN", VERSION001, PARENT_LOCAL_NAME, "LN",
Instant.ofEpochSecond(timeStamp)));
@@ -152,7 +152,7 @@ public class PfReferenceTimestampKeyTest {
assertThatThrownBy(() -> key1.isNewerThan((PfKey) null)).isInstanceOf(NullPointerException.class)
.hasMessageMatching("^otherKey is marked .*on.*ull but is null$");
- key2.setTimeStamp(Timestamp.from(Instant.ofEpochSecond(timeStamp).plusSeconds(80)));
+ key2.setTimeStamp(Date.from(Instant.ofEpochSecond(timeStamp).plusSeconds(80)));
assertTrue(key2.isNewerThan(key1));
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java
index e6a998894..4afdadff3 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,8 +26,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import java.sql.Timestamp;
import java.time.Instant;
+import java.util.Date;
import org.junit.Test;
public class PfTimestampKeyTest {
@@ -41,7 +42,7 @@ public class PfTimestampKeyTest {
PfTimestampKey someKey0 = new PfTimestampKey();
assertEquals(PfTimestampKey.getNullKey(), someKey0);
assertTrue(someKey0.isNullKey());
- assertEquals("PfTimestampKey(name=NULL, version=0.0.0, timeStamp=" + Timestamp.from(Instant.EPOCH) + ")",
+ assertEquals("PfTimestampKey(name=NULL, version=0.0.0, timeStamp=" + Date.from(Instant.EPOCH) + ")",
someKey0.toString());
PfTimestampKey someKey1 = new PfTimestampKey("my-name", VERSION001, Instant.ofEpochSecond(timeStamp));
@@ -51,7 +52,7 @@ public class PfTimestampKeyTest {
assertEquals(someKey1, someKey3);
assertFalse(someKey1.isNullVersion());
assertEquals("PfTimestampKey(name=my-name, version=0.0.1, timeStamp="
- + Timestamp.from(Instant.ofEpochSecond(timeStamp)) + ")", someKey1.toString());
+ + Date.from(Instant.ofEpochSecond(timeStamp)) + ")", someKey1.toString());
assertEquals("my-name", someKey1.getName());
assertEquals(VERSION001, someKey1.getVersion());
@@ -79,7 +80,7 @@ public class PfTimestampKeyTest {
assertFalse(someKey1.isNewerThan(someKey2));
assertThatThrownBy(() -> someKey1.isNewerThan((PfKey) null)).isInstanceOf(NullPointerException.class)
.hasMessageMatching("^otherKey is marked .*on.*ull but is null$");
- someKey2.setTimeStamp(Timestamp.from(Instant.ofEpochSecond(timeStamp).plusMillis(90)));
+ someKey2.setTimeStamp(Date.from(Instant.ofEpochSecond(timeStamp).plusMillis(90)));
assertTrue(someKey2.isNewerThan(someKey1));
someKey3.setName("my-name3");
assertTrue(someKey3.isNewerThan(someKey1));