common code coverage increase
[sdc.git] / common / onap-tosca-datatype / src / test / java / org / onap / sdc / tosca / datatypes / model / TopologyTemplateTest.java
diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplateTest.java
new file mode 100644 (file)
index 0000000..e033c65
--- /dev/null
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.tosca.datatypes.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class TopologyTemplateTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(TopologyTemplate.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void groupShouldBeNullWhenNotInitialized() {
+        TopologyTemplate topologyTemplate = new TopologyTemplate();
+        assertNull(topologyTemplate.getGroups());
+    }
+
+    @Test
+    public void addGroupShouldCorrectlyInitializeAndAddGroup() {
+        String key = "group1";
+        GroupDefinition groupDefinition = new GroupDefinition();
+        TopologyTemplate topologyTemplate = new TopologyTemplate();
+        topologyTemplate.addGroup(key, groupDefinition);
+
+        assertTrue(topologyTemplate.getGroups().containsKey(key));
+        assertEquals(groupDefinition, topologyTemplate.getGroups().get(key));
+
+    }
+}
\ No newline at end of file