Add junit coverage to RequestInfoBuilder class
[appc.git] / appc-sequence-generator / appc-sequence-generator-bundle / src / test / java / org / onap / appc / seqgen / objects / RequestInfoBuilderTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6  * =============================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.appc.seqgen.objects;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25
26 import org.junit.Before;
27 import org.junit.Test;
28
29 public class RequestInfoBuilderTest {
30     private RequestInfoBuilder builder;
31
32     @Before
33     public void setUp() {
34         builder = new RequestInfoBuilder();
35     }
36
37     @Test
38     public void testAction() {
39         String action = builder.action("Action").build().getAction();
40         assertNotNull(action);
41         assertEquals(action, "Action");
42     }
43
44
45     @Test
46     public void testActionLevel() {
47         String actionLevel = builder.actionLevel("ActionLevel").build().getActionLevel();
48         assertNotNull(actionLevel);
49         assertEquals(actionLevel, "ActionLevel");
50     }
51
52
53     @Test
54     public void testPayload() {
55         String payload = builder.payload("Payload").build().getPayload();
56         assertNotNull(payload);
57         assertEquals(payload, "Payload");
58     }
59
60     @Test
61     public void testActionIdentifier() {
62         assertNotNull(builder.actionIdentifier());
63         assertNotNull(builder.build().getActionIdentifier());
64     }
65
66     @Test
67     public void testVnfId() {
68         assertNotNull(builder.actionIdentifier());
69         String vnfId = builder.vnfId("VnfId").build().getActionIdentifier().getVnfId();
70         assertNotNull(vnfId);
71         assertEquals(vnfId, "VnfId");
72     }
73
74     @Test
75     public void testVnfcName() {
76         assertNotNull(builder.actionIdentifier());
77         String vnfcName = builder.vnfcName("VnfcName").build().getActionIdentifier().getVnfcName();
78         assertNotNull(vnfcName);
79         assertEquals(vnfcName, "VnfcName");
80     }
81
82     @Test
83     public void testVServerId() {
84         assertNotNull(builder.actionIdentifier());
85         String vServerId = builder.vServerId("VServerId").build().getActionIdentifier().getvServerId();
86         assertNotNull(vServerId);
87         assertEquals(vServerId, "VServerId");
88     }
89
90     @Test
91     public void testBuild() {
92         RequestInfo info = builder.actionIdentifier()
93                                   .vnfId("VnfId")
94                                   .vnfcName("VnfcName")
95                                   .vServerId("VServerId")
96                                   .action("Action")
97                                   .actionLevel("ActionLevel")
98                                   .payload("Payload")
99                                   .build();
100         assertNotNull(info);
101         ActionIdentifier id = info.getActionIdentifier();
102         assertNotNull(id);
103         String str;
104         str = id.getVnfId();
105         assertNotNull(str);
106         assertEquals(str, "VnfId");
107         str = id.getVnfcName();
108         assertNotNull(str);
109         assertEquals(str, "VnfcName");
110         str = id.getvServerId();
111         assertNotNull(str);
112         assertEquals(str, "VServerId");
113         str = info.getAction();
114         assertNotNull(str);
115         assertEquals(str, "Action");
116         str = info.getActionLevel();
117         assertNotNull(str);
118         assertEquals(str, "ActionLevel");
119         str = info.getPayload();
120         assertNotNull(str);
121         assertEquals(str, "Payload");
122     }
123
124 }