summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/events
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-03 17:45:29 -0400
committerJim Hahn <jrh3@att.com>2020-04-03 18:00:05 -0400
commitea9113151c030efdd9b393787f1e57bc72734e88 (patch)
tree0b8ad50a62f798c861e4b809eca1e0b8e0138d59 /models-interactions/model-impl/events
parent5f789441acfc2964c16052f1c65206018b1e8b41 (diff)
Models junits are failing locally
Junits were failing in my local eclipse environment. Fixed the following: - more cases of "is marked @NonNull but is null" (I thought Liam had already fixed all of these, but I'm still seeing errors, so fixed some more) - comparing "Instant" values in event time stamps assumes that the times will be different, but may not be, if the JVM is fast enough. Modified the test to set the times of the new events to Instant+1, to ensure that they are different from the original Issue-ID: POLICY-2305 Change-Id: Ic05bc6a58b559ba589583ce887711ee01f76691c Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-impl/events')
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java2
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java4
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java4
-rw-r--r--models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java2
4 files changed, 6 insertions, 6 deletions
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java
index e1ef77e22..22ef769f9 100644
--- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java
@@ -41,7 +41,7 @@ public class AbatedTest {
assertEquals(event.getClosedLoopAlarmStart(), abated.getClosedLoopAlarmStart());
assertEquals(ControlLoopEventStatus.ABATED, abated.getClosedLoopEventStatus());
- abated.setClosedLoopAlarmEnd(Instant.now());
+ abated.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
assertNotEquals(abated, event);
assertEquals(new Abated(abated), abated);
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java
index d7007bc97..5aa7497e9 100644
--- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java
@@ -38,8 +38,8 @@ public class CanonicalAbatedTest {
CanonicalAbated abated2 = new CanonicalAbated(new Abated());
abated2.setRequestId(UUID.randomUUID());
- abated2.setClosedLoopAlarmStart(Instant.now());
- abated2.setClosedLoopAlarmEnd(Instant.now());
+ abated2.setClosedLoopAlarmStart(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
+ abated2.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
CanonicalAbated abated3 = new CanonicalAbated(abated2);
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java
index 7b0a43f9e..23e1fffbd 100644
--- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java
@@ -38,8 +38,8 @@ public class CanonicalOnsetTest {
CanonicalOnset onset2 = new CanonicalOnset(new Onset());
onset2.setRequestId(UUID.randomUUID());
- onset2.setClosedLoopAlarmStart(Instant.now());
- onset2.setClosedLoopAlarmEnd(Instant.now());
+ onset2.setClosedLoopAlarmStart(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
+ onset2.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
CanonicalOnset onset3 = new CanonicalOnset(onset2);
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java
index b229b024b..5dadff1b6 100644
--- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java
+++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java
@@ -42,7 +42,7 @@ public class OnsetTest {
assertEquals(ControlLoopEventStatus.ONSET, onset.getClosedLoopEventStatus());
assertEquals(event.getClosedLoopAlarmEnd(), onset.getClosedLoopAlarmEnd());
- onset.setClosedLoopAlarmEnd(Instant.now());
+ onset.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
assertNotEquals(onset, event);
assertEquals(new Onset(onset), onset);