2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.model;
23 import org.junit.Test;
24 import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
26 import java.util.HashMap;
27 import java.util.LinkedList;
28 import java.util.List;
31 public class ArtifactDefinitionTest {
33 private ArtifactDefinition createTestSubject() {
34 return new ArtifactDefinition();
38 public void testCtor() throws Exception {
39 new ArtifactDefinition(new ArtifactDefinition());
40 new ArtifactDefinition(new ArtifactDataDefinition());
41 new ArtifactDefinition(new HashMap<>());
42 new ArtifactDefinition(new ArtifactDataDefinition(), "mock");
46 public void testGetPayloadData() throws Exception {
47 ArtifactDefinition testSubject;
51 testSubject = createTestSubject();
52 result = testSubject.getPayloadData();
57 public void testSetPayload() throws Exception {
58 ArtifactDefinition testSubject;
59 byte[] payloadData = new byte[] { ' ' };
62 testSubject = createTestSubject();
63 testSubject.setPayload(payloadData);
68 public void testSetPayloadData() throws Exception {
69 ArtifactDefinition testSubject;
70 String payloadData = "";
73 testSubject = createTestSubject();
75 testSubject.setPayloadData(payloadData);
78 testSubject = createTestSubject();
80 testSubject.setPayloadData(payloadData);
85 public void testGetListHeatParameters() throws Exception {
86 ArtifactDefinition testSubject;
87 List<HeatParameterDefinition> result;
90 testSubject = createTestSubject();
91 result = testSubject.getListHeatParameters();
92 testSubject.setHeatParameters(new LinkedList<>());
93 result = testSubject.getListHeatParameters();
98 public void testSetListHeatParameters() throws Exception {
99 ArtifactDefinition testSubject;
100 List<HeatParameterDefinition> properties = null;
103 testSubject = createTestSubject();
104 testSubject.setListHeatParameters(properties);
105 properties = new LinkedList<>();
106 testSubject.setListHeatParameters(properties);
111 public void testCheckEsIdExist() throws Exception {
112 ArtifactDefinition testSubject;
116 testSubject = createTestSubject();
117 result = testSubject.checkEsIdExist();
118 testSubject.setEsId("mock");
119 result = testSubject.checkEsIdExist();
124 public void testHashCode() throws Exception {
125 ArtifactDefinition testSubject;
129 testSubject = createTestSubject();
130 result = testSubject.hashCode();
135 public void testEquals() throws Exception {
136 ArtifactDefinition testSubject;
140 testSubject = createTestSubject();
141 result = testSubject.equals(null);
142 result = testSubject.equals(testSubject);
143 result = testSubject.equals(new Object());
144 result = testSubject.equals(createTestSubject());