2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 Fujitsu Limited. 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.tosca.model;
23 import org.junit.Test;
25 import java.util.HashMap;
28 import static org.hamcrest.CoreMatchers.is;
29 import static org.junit.Assert.assertThat;
31 public class ToscaDataTypeTest {
32 private static final String DERIVED_FROM = "tosca.datatypes.Root";
33 private static final String VERSION = "1.1";
34 private static final String DESCRIPTION = "data type description";
35 private static final String PROPERTY_NAME = "prop1";
36 private static final String METADATA_KEY = "foo";
37 private static final String METADATA_VALUE = "bar";
39 private ToscaDataType testSubject;
42 public void testToscaDataType() throws Exception {
43 testSubject = new ToscaDataType();
44 testSubject.setDerived_from(DERIVED_FROM);
45 testSubject.setVersion(VERSION);
46 testSubject.setDescription(DESCRIPTION);
47 Map<String, String> metadata = new HashMap<>();
48 metadata.put(METADATA_KEY, METADATA_VALUE);
49 testSubject.setMetadata(metadata);
50 Map<String, ToscaProperty> properties = new HashMap<>();
51 properties.put(PROPERTY_NAME, new ToscaProperty());
52 testSubject.setProperties(properties);
54 assertThat(testSubject.getDerived_from(), is(DERIVED_FROM));
55 assertThat(testSubject.getVersion(), is(VERSION));
56 assertThat(testSubject.getDescription(), is(DESCRIPTION));
57 assertThat(testSubject.getMetadata(), is(metadata));
58 assertThat(testSubject.getProperties(), is(properties));