aboutsummaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerTest.java')
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerTest.java33
1 files changed, 20 insertions, 13 deletions
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerTest.java
index 241c92978..fdb886e10 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerTest.java
@@ -144,18 +144,20 @@ public class JsonEventHandlerTest {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventNoName();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: event received without "
- + "mandatory parameter \"name\" ");
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("event received without mandatory parameter \"name\" ");
assertThatThrownBy(() -> {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventBadName();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: field \"name\" with value \"%%%%\" is invalid");
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("field \"name\" with value \"%%%%\" is invalid");
assertThatThrownBy(() -> {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventNoExName();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: an event definition for an event named \"I_DONT_EXI");
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("an event definition for an event named \"I_DONT_EXI");
String apexEventJsonStringIn1 = null;
apexEventJsonStringIn1 = SupportJsonEventGenerator.jsonEventNoVersion();
ApexEvent event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn1).get(0);
@@ -164,12 +166,14 @@ public class JsonEventHandlerTest {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventBadVersion();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: field \"version\" with value \"#####\" is invalid");
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("field \"version\" with value \"#####\" is invalid");
assertThatThrownBy(() -> {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventNoExVersion();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: an event definition for an event named "
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("an event definition for an event named "
+ "\"BasicEvent\" with version \"1.2.3\" not found in Apex model");
apexEventJsonStringIn1 = SupportJsonEventGenerator.jsonEventNoNamespace();
event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn1).get(0);
@@ -179,13 +183,14 @@ public class JsonEventHandlerTest {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventBadNamespace();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: " + "field \"nameSpace\" with value \"hello.&&&&\" "
- + "is invalid");
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("field \"nameSpace\" with value \"hello.&&&&\" is invalid");
assertThatThrownBy(() -> {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventNoExNamespace();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: namespace \"pie.in.the.sky\" "
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("namespace \"pie.in.the.sky\" "
+ "on event \"BasicEvent\" does not" + " match namespace \"org.onap.policy.apex.events\" "
+ "for that event in the Apex model");
apexEventJsonStringIn1 = SupportJsonEventGenerator.jsonEventNoSource();
@@ -196,7 +201,8 @@ public class JsonEventHandlerTest {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventBadSource();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: field \"source\" with value \"%!@**@!\" is invalid");
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("field \"source\" with value \"%!@**@!\" is invalid");
apexEventJsonStringIn1 = SupportJsonEventGenerator.jsonEventNoTarget();
event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn1).get(0);
assertEquals("target", event.getTarget());
@@ -205,13 +211,14 @@ public class JsonEventHandlerTest {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventBadTarget();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: field \"target\" with value \"KNIO(*S)A(S)D\" "
- + "is invalid");
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("field \"target\" with value \"KNIO(*S)A(S)D\" is invalid");
assertThatThrownBy(() -> {
String apexEventJsonStringIn = null;
apexEventJsonStringIn = SupportJsonEventGenerator.jsonEventMissingFields();
jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
- }).hasMessageContaining("Failed to unmarshal JSON event: error parsing BasicEvent:0.0.1 "
+ }).hasMessageStartingWith("Failed to unmarshal JSON event")
+ .getCause().hasMessageStartingWith("error parsing BasicEvent:0.0.1 "
+ "event from Json. Field \"intPar\" is missing, but is mandatory.");
apexEventJsonStringIn1 = SupportJsonEventGenerator.jsonEventNullFields();
event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn1).get(0);