2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.sdc.tosca.datatypes.model;
18 import java.util.ArrayList;
19 import org.junit.Assert;
20 import org.junit.Test;
22 public class PropertyDefinitionTest {
25 public void cloneTest() {
26 PropertyDefinition propertyDefinition = new PropertyDefinition();
27 propertyDefinition.setRequired(false);
28 propertyDefinition.setStatus(Status.DEPRECATED);
29 Constraint constraint = new Constraint();
30 constraint.setEqual("123");
31 ArrayList<Constraint> constraints = new ArrayList<>();
32 constraints.add(constraint);
33 propertyDefinition.setConstraints(constraints);
35 PropertyDefinition propertyDefinitionClone = propertyDefinition.clone();
36 Assert.assertEquals(propertyDefinition.getRequired(), propertyDefinitionClone.getRequired());
37 Assert.assertEquals(propertyDefinition.getStatus().getDisplayName(),
38 propertyDefinitionClone.getStatus().getDisplayName());
39 Assert.assertEquals(propertyDefinition.getConstraints().get(0).getEqual(),
40 propertyDefinitionClone.getConstraints().get(0).getEqual());