Increase code coverage
[aai/spike.git] / src / test / java / org / onap / aai / spike / event / outgoing / SpikeGraphEventTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 package org.onap.aai.spike.event.outgoing;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNull;
25 import org.junit.Test;
26
27 public class SpikeGraphEventTest {
28     @Test
29     public void testGetObjectKey() {
30         String objectKey;
31
32         SpikeGraphEvent spikeGraphEvent;
33
34         spikeGraphEvent = new SpikeGraphEvent();
35         SpikeVertex vertex = new SpikeVertex();
36         vertex.setId("addfff68");
37         spikeGraphEvent.setVertex(vertex);
38         objectKey = spikeGraphEvent.getObjectKey();
39         assertEquals("addfff68", objectKey);
40
41         spikeGraphEvent = new SpikeGraphEvent();
42         SpikeEdge relationship = new SpikeEdge();
43         relationship.setId("909d");
44
45         spikeGraphEvent.setRelationship(relationship);
46         objectKey = spikeGraphEvent.getObjectKey();
47         assertEquals("909d", objectKey);
48
49         spikeGraphEvent = new SpikeGraphEvent();
50         objectKey = spikeGraphEvent.getObjectKey();
51         assertNull(objectKey);
52     }
53
54     @Test
55     public void testGetObjectType() {
56         String objectType;
57         String type = "pserver";
58         SpikeGraphEvent spikeGraphEvent;
59
60         spikeGraphEvent = new SpikeGraphEvent();
61         SpikeVertex vertex = new SpikeVertex();
62         vertex.setType(type);
63         spikeGraphEvent.setVertex(vertex);
64         objectType = spikeGraphEvent.getObjectType();
65         assertEquals("Vertex->" + type, objectType);
66
67         spikeGraphEvent = new SpikeGraphEvent();
68         SpikeEdge relationship = new SpikeEdge();
69         relationship.setType(type);
70
71         spikeGraphEvent.setRelationship(relationship);
72         objectType = spikeGraphEvent.getObjectType();
73         assertEquals("Relationship->" + type, objectType);
74
75         spikeGraphEvent = new SpikeGraphEvent();
76         objectType = spikeGraphEvent.getObjectType();
77         assertNull(objectType);
78     }
79 }