aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java
diff options
context:
space:
mode:
authorSanchez, Gabriel (gs882h) <gabriel.sanchez@amdocs.com>2019-03-11 17:14:03 +0000
committerSanchez, Gabriel (gs882h) <gabriel.sanchez@amdocs.com>2019-03-12 08:48:14 +0000
commita92189c6161f7bb8494cb8ea519885533bc34f53 (patch)
tree4b4fffa0a32b0887b0397d0dff3f3cbde73cfb19 /src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java
parent911ff8d32b998806427c20bae84115d2401192a0 (diff)
Increase code coverage to 55% for Dublin
Remove unused class and add some exception coverage test using exceptionRule Issue-ID: AAI-2221 Change-Id: I022f7a24f7247fe6dd213ddf9631823b3c1b5d1b Signed-off-by: Sanchez, Gabriel (gs882h) <gabriel.sanchez@amdocs.com>
Diffstat (limited to 'src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java')
-rw-r--r--src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java b/src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java
index 87b298f..49fb5ef 100644
--- a/src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java
+++ b/src/test/java/org/onap/aai/spike/event/incoming/GizmoGraphEventTest.java
@@ -24,7 +24,10 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.io.IOException;
import java.net.URISyntaxException;
+
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.spike.OXMModelLoaderSetup;
@@ -36,6 +39,11 @@ import org.onap.aai.spike.test.util.TestFileReader;
@RunWith(MockitoJUnitRunner.Silent.class)
public class GizmoGraphEventTest extends OXMModelLoaderSetup {
+ private static final String SPIKE_EXCEPTION_MESSAGE = "Unable to parse JSON string: Empty or null JSON string.";
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
@Test
public void TestToSpikeGraphEvent() throws SpikeException, IOException, URISyntaxException {
String champNotification =
@@ -63,6 +71,8 @@ public class GizmoGraphEventTest extends OXMModelLoaderSetup {
gizmoGraphEvent = new GizmoGraphEvent();
GizmoEdge relationship = new GizmoEdge();
+ relationship.setSource(vertex);
+ relationship.setTarget(vertex);
relationship.setId("909d");
gizmoGraphEvent.setRelationship(relationship);
@@ -99,4 +109,32 @@ public class GizmoGraphEventTest extends OXMModelLoaderSetup {
objectType = gizmoGraphEvent.getObjectType();
assertNull(objectType);
}
+
+ @Test
+ public void TestGizmoEdgeExceptionEmpty() throws SpikeException {
+ exceptionRule.expect(SpikeException.class);
+ exceptionRule.expectMessage(SPIKE_EXCEPTION_MESSAGE);
+ GizmoEdge.fromJson("");
+ }
+
+ @Test
+ public void TestGizmoEdgeExceptionNull() throws SpikeException {
+ exceptionRule.expect(SpikeException.class);
+ exceptionRule.expectMessage(SPIKE_EXCEPTION_MESSAGE);
+ GizmoEdge.fromJson(null);
+ }
+
+ @Test
+ public void TestGizmoVertexExceptionEmpty() throws SpikeException {
+ exceptionRule.expect(SpikeException.class);
+ exceptionRule.expectMessage(SPIKE_EXCEPTION_MESSAGE);
+ GizmoVertex.fromJson("");
+ }
+
+ @Test
+ public void TestGizmoVertexExceptionNull() throws SpikeException {
+ exceptionRule.expect(SpikeException.class);
+ exceptionRule.expectMessage(SPIKE_EXCEPTION_MESSAGE);
+ GizmoVertex.fromJson(null);
+ }
}