Some unit tests for catalog-be 52/85052/3
authorTomasz Golabek <tomasz.golabek@nokia.com>
Thu, 11 Apr 2019 12:29:49 +0000 (14:29 +0200)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Tue, 30 Apr 2019 11:34:29 +0000 (11:34 +0000)
Code coverage for some classes from catalog-be increased.
Some refactor made if needed.

Change-Id: Ia9348f624984ab7e5f9aa53c0adf33cf5867fa07
Issue-ID: SDC-2220
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
12 files changed:
catalog-be/pom.xml
catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java
catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java
catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java
catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java
catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponceTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfoTest.java [new file with mode: 0644]
catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifactsTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipListTest.java [new file with mode: 0644]

index 8e5ed15..58caad2 100644 (file)
@@ -12,6 +12,7 @@
     </parent>
 
     <properties>
+        <java-hamcrest.version>2.0.0.0</java-hamcrest.version>
     </properties>
 
     <dependencies>
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+            <version>${java-hamcrest.version}</version>
+            <scope>test</scope>
+        </dependency>
+
         <dependency>
             <groupId>org.codehaus.groovy</groupId>
             <artifactId>groovy</artifactId>
index 11a4269..1aad998 100644 (file)
@@ -7,19 +7,23 @@
  * 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
  */
 
 package org.openecomp.sdc.be.info;
 
+import java.util.Arrays;
+import java.util.Optional;
 import org.openecomp.sdc.common.log.wrappers.Logger;
 
 public enum DistributionStatus {
@@ -44,18 +48,13 @@ public enum DistributionStatus {
     }
 
     public static DistributionStatus getStatusByAuditingStatusName(String auditingStatus) {
-        DistributionStatus res = null;
-        DistributionStatus[] values = values();
-        for (DistributionStatus value : values) {
-            if (value.getAuditingStatus().equals(auditingStatus)) {
-                res = value;
-                break;
-            }
-        }
-        if (res == null) {
-            log.debug("No DistributionStatus  is mapped to name {}", auditingStatus);
+        Optional<DistributionStatus> distributionStatus = Arrays.stream(values())
+            .filter(value -> value.getAuditingStatus().equals(auditingStatus)).findAny();
+        if (!distributionStatus.isPresent()){
+            log.debug("No DistributionStatus is mapped to name {}", auditingStatus);
         }
-        return res;
+        // it should be replaced by some exception handling. Keeping it only for the purpose of backward compatibility
+        return distributionStatus.orElse(null);
     }
 
 }
index e7a0706..621485c 100644 (file)
@@ -7,17 +7,18 @@
  * 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
  */
-
 package org.openecomp.sdc.be.info;
 
 import org.openecomp.sdc.be.model.GroupDefinition;
@@ -62,9 +63,7 @@ public class GroupDefinitionInfo {
 
     private List<? extends GroupProperty> properties;
 
-    public GroupDefinitionInfo() {
-        super();
-    }
+    public GroupDefinitionInfo() {}
 
     public GroupDefinitionInfo(GroupDefinition other) {
         this.setName(other.getName());
@@ -139,7 +138,6 @@ public class GroupDefinitionInfo {
         this.version = version;
     }
 
-
     public String getCustomizationUUID() {
         return customizationUUID;
     }
@@ -172,8 +170,6 @@ public class GroupDefinitionInfo {
         this.properties = (properties==null) ? null : new ArrayList<>(properties);
     }
 
-
-
     public String getGroupInstanceUniqueId() {
         return groupInstanceUniqueId;
     }
index 301cffa..3ae0dcd 100644 (file)
@@ -25,9 +25,7 @@ public class GroupTemplateInfo {
     boolean isBase;
     ArtifactTemplateInfo artifactTemplateInfo;
 
-    public GroupTemplateInfo() {
-        super();
-    }
+    public GroupTemplateInfo() {}
 
     public String getGroupName() {
         return groupName;
index 766581b..9ab0bd7 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
 package org.openecomp.sdc.be.info;
 
 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
@@ -12,6 +33,7 @@ public class NodeTypeInfoToUpdateArtifacts {
     private String nodeName;
     private Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle;
 
+    NodeTypeInfoToUpdateArtifacts() {}
 
     public NodeTypeInfoToUpdateArtifacts(String nodeName,
             Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle) {
index e4d3c9b..c95b802 100644 (file)
@@ -1,12 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
 package org.openecomp.sdc.be.info;
 
 import org.junit.Test;
 
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
 import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
 import static org.hamcrest.MatcherAssert.assertThat;
 
-
 public class DistributionStatusOfServiceListResponceTest {
+
+    @Test
+    public void shouldHaveValidDefaultConstructor() {
+        assertThat(DistributionStatusOfServiceListResponce.class, hasValidBeanConstructor());
+    }
+
     @Test
     public void shouldHaveValidGettersAndSetters() {
         assertThat(DistributionStatusOfServiceListResponce.class, hasValidGettersAndSetters());
index f8ce8ad..1b3633c 100644 (file)
@@ -1,39 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
 package org.openecomp.sdc.be.info;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
 import org.junit.Test;
 
 public class DistributionStatusTest {
 
-       private DistributionStatus createTestSubject() {
-               return DistributionStatus.DEPLOYED;
-       }
-
        @Test
-       public void testGetName() throws Exception {
-               DistributionStatus testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getName();
+       public void deployedStatusShouldProvideCorrectStrings() {
+               assertThat(DistributionStatus.DEPLOYED.getName(), is("Deployed"));
+               assertThat(DistributionStatus.DEPLOYED.getAuditingStatus(), is("DEPLOYED"));
        }
 
        @Test
-       public void testGetAuditingStatus() throws Exception {
-               DistributionStatus testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getAuditingStatus();
+       public void shouldGetStatusByAuditingStatusName() {
+               DistributionStatus deployed = DistributionStatus.getStatusByAuditingStatusName("DEPLOYED");
+               assertThat(deployed, is(DistributionStatus.DEPLOYED));
        }
 
        @Test
-       public void testGetStatusByAuditingStatusName() throws Exception {
-               String auditingStatus = "";
-               DistributionStatus result;
-
-               // default test
-               result = DistributionStatus.getStatusByAuditingStatusName(auditingStatus);
+       public void shouldNotGetStatusByAuditingStatusName() {
+               DistributionStatus deployed = DistributionStatus.getStatusByAuditingStatusName("DIFFERENT_THAN_DEPLOYED");
+               assertThat(deployed, is(nullValue()));
        }
 }
\ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfoTest.java
new file mode 100644 (file)
index 0000000..e814605
--- /dev/null
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. 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.openecomp.sdc.be.info;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.Collections;
+import java.util.Set;
+import org.junit.Test;
+
+public class GenericArtifactQueryInfoTest {
+
+    private static final String ARTIFACT_UNIQUE_ID = "artifactId";
+    private static final String PARENT_ID = "parentId";
+    private static final Set<String> FIELDS = Collections.emptySet();
+
+    @Test
+    public void shouldHaveValidDefaultConstructor() {
+        assertThat(GenericArtifactQueryInfo.class, hasValidBeanConstructor());
+    }
+
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(GenericArtifactQueryInfo.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void shouldTestConstructorCorrectlySetFields(){
+        GenericArtifactQueryInfo genericArtifactQueryInfo = new GenericArtifactQueryInfo(FIELDS, PARENT_ID,
+            ARTIFACT_UNIQUE_ID);
+        assertThat(genericArtifactQueryInfo.getArtifactUniqueId(), is(ARTIFACT_UNIQUE_ID));
+        assertThat(genericArtifactQueryInfo.getFields(), is(FIELDS));
+        assertThat(genericArtifactQueryInfo.getParentId(), is(PARENT_ID));
+    }
+}
\ No newline at end of file
index 1fb44a0..bc8041b 100644 (file)
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
 package org.openecomp.sdc.be.info;
 
-import org.junit.Ignore;
+import java.util.ArrayList;
+import java.util.List;
 import org.junit.Test;
+
+import com.google.code.beanmatchers.BeanMatchers;
+import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
 import org.openecomp.sdc.be.model.GroupDefinition;
 import org.openecomp.sdc.be.model.GroupInstance;
 
-import com.google.code.beanmatchers.BeanMatchers;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-
+import static org.hamcrest.Matchers.matchesPattern;
 
 public class GroupDefinitionInfoTest {
-       @Test
-    public void testCtor() {
-               new GroupDefinitionInfo(new GroupDefinition());
-               new GroupDefinitionInfo(new GroupInstance());
-       }
-
-    @Ignore("the test fails on null pointer how ever the method does exists.")
-       @Test
+
+    private static final String ARTIFACT_NAME = "artifactName";
+    private static final String TO_STRING_REGEXP = "GroupDefinitionInfo \\[org.openecomp.sdc.be.info.GroupDefinitionInfo@" +
+        ".*" + ", isBase=true, artifacts=\\[org.openecomp.sdc.be.info.ArtifactDefinitionInfo@" + ".*" + "\\]\\]";
+    private static final String GROUP_UUID = "GROUP_UUID";
+    private static final String INVARIANT_UUID = "INVARIANT_UUID";
+    private static final String VERSION = "VERSION";
+    private static final String UNIQUE_ID = "UNIQUE_ID";
+    private static final String DESC = "DESC";
+    private static final String NAME = "NAME";
+
+    @Test
+    public void shouldHaveValidDefaultConstructor() {
+        assertThat(GroupDefinitionInfo.class, hasValidBeanConstructor());
+    }
+
+    @Test
+    public void testShouldConstructObjectFromGroupDefinition() {
+        GroupDefinition groupDefinition = createGroupDefinition();
+        GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo(groupDefinition);
+        assertThat(groupDefinitionInfo.getName(), is(groupDefinition.getName()));
+        assertThat(groupDefinitionInfo.getDescription(), is(groupDefinition.getDescription()));
+        assertThat(groupDefinitionInfo.getUniqueId(), is(groupDefinition.getUniqueId()));
+        assertThat(groupDefinitionInfo.getVersion(), is(groupDefinition.getVersion()));
+        assertThat(groupDefinitionInfo.getInvariantUUID(), is(groupDefinition.getInvariantUUID()));
+        assertThat(groupDefinitionInfo.getGroupUUID(), is(groupDefinition.getGroupUUID()));
+    }
+
+    @Test
+    public void testShouldConstructObjectFromGroupInstance() {
+        GroupInstanceDataDefinition groupInstanceDataDefinition = createGroupInstanceDataDefinition();
+        GroupInstance groupInstance = new GroupInstance(groupInstanceDataDefinition);
+        GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo(groupInstance);
+        assertThat(groupDefinitionInfo.getName(), is(groupInstanceDataDefinition.getGroupName()));
+        assertThat(groupDefinitionInfo.getDescription(), is(groupInstanceDataDefinition.getDescription()));
+        assertThat(groupDefinitionInfo.getGroupInstanceUniqueId(), is(groupInstanceDataDefinition.getUniqueId()));
+        assertThat(groupDefinitionInfo.getVersion(), is(groupInstanceDataDefinition.getVersion()));
+        assertThat(groupDefinitionInfo.getInvariantUUID(), is(groupInstanceDataDefinition.getInvariantUUID()));
+        assertThat(groupDefinitionInfo.getGroupUUID(), is(groupInstanceDataDefinition.getGroupUUID()));
+    }
+
+    @Test
     public void shouldHaveValidGettersAndSetters() {
-        assertThat(GroupDefinitionInfo.class, BeanMatchers.hasValidGettersAndSetters());
+        assertThat(GroupDefinitionInfo.class, BeanMatchers.hasValidGettersAndSettersExcluding("artifacts", "properties"));
     }
-    
+
     @Test
     public void testToString() {
-        (new GroupDefinitionInfo()).toString();
+        GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo();
+        List<ArtifactDefinitionInfo> artifacts = new ArrayList<>();
+        ArtifactDefinitionInfo artifactDefinitionInfo = new ArtifactDefinitionInfo();
+        artifactDefinitionInfo.setArtifactName(ARTIFACT_NAME);
+        artifacts.add(artifactDefinitionInfo);
+        groupDefinitionInfo.setArtifacts(artifacts);
+        groupDefinitionInfo.setIsBase(true);
+        assertThat(groupDefinitionInfo.toString(), matchesPattern(TO_STRING_REGEXP));
     }
+
+    private GroupDefinition createGroupDefinition() {
+        GroupDataDefinition groupDataDefinition = new GroupDataDefinition();
+        groupDataDefinition.setName(NAME);
+        groupDataDefinition.setDescription(DESC);
+        groupDataDefinition.setUniqueId(UNIQUE_ID);
+        groupDataDefinition.setVersion(VERSION);
+        groupDataDefinition.setInvariantUUID(INVARIANT_UUID);
+        groupDataDefinition.setGroupUUID(GROUP_UUID);
+        return new GroupDefinition(groupDataDefinition);
+    }
+
+    private GroupInstanceDataDefinition createGroupInstanceDataDefinition() {
+        GroupInstanceDataDefinition groupInstanceDataDefinition = new GroupInstanceDataDefinition();
+        groupInstanceDataDefinition.setGroupName(NAME);
+        groupInstanceDataDefinition.setDescription(DESC);
+        groupInstanceDataDefinition.setUniqueId(UNIQUE_ID);
+        groupInstanceDataDefinition.setVersion(VERSION);
+        groupInstanceDataDefinition.setInvariantUUID(INVARIANT_UUID);
+        groupInstanceDataDefinition.setGroupUUID(GROUP_UUID);
+        return groupInstanceDataDefinition;
+    }
+
 }
\ No newline at end of file
index 03573e1..dcce6fd 100644 (file)
@@ -1,13 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
 package org.openecomp.sdc.be.info;
 
 import org.junit.Test;
 
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
 import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
 import static org.hamcrest.MatcherAssert.assertThat;
 
-
 public class GroupTemplateInfoTest {
 
+    @Test
+    public void shouldHaveValidDefaultConstructor() {
+        assertThat(DistributionStatusOfServiceListResponce.class, hasValidBeanConstructor());
+    }
 
     @Test
     public void shouldHaveValidGettersAndSetters() {
index 25c71cf..388d637 100644 (file)
@@ -1,56 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
 package org.openecomp.sdc.be.info;
 
-import org.junit.Test;
-import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 
+import java.util.Collections;
 import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
+import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
 
 public class NodeTypeInfoToUpdateArtifactsTest {
 
-       private NodeTypeInfoToUpdateArtifacts createTestSubject() {
-               return new NodeTypeInfoToUpdateArtifacts("", null);
-       }
+       private static final String NAME = "NAME";
+       private static final Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> NODE_TYPES_ARTIFACTS_TO_HANDLE = Collections
+               .emptyMap();
 
        @Test
-       public void testGetNodeName() throws Exception {
-               NodeTypeInfoToUpdateArtifacts testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getNodeName();
+       public void shouldHaveValidGettersAndSetters() {
+               assertThat(NodeTypeInfoToUpdateArtifacts.class, hasValidGettersAndSetters());
        }
 
        @Test
-       public void testSetNodeName() throws Exception {
-               NodeTypeInfoToUpdateArtifacts testSubject;
-               String nodeName = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setNodeName(nodeName);
-       }
-
-       @Test
-       public void testGetNodeTypesArtifactsToHandle() throws Exception {
-               NodeTypeInfoToUpdateArtifacts testSubject;
-               Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getNodeTypesArtifactsToHandle();
-       }
-
-       @Test
-       public void testSetNodeTypesArtifactsToHandle() throws Exception {
-               NodeTypeInfoToUpdateArtifacts testSubject;
-               Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setNodeTypesArtifactsToHandle(nodeTypesArtifactsToHandle);
+       public void shouldConstructCorrectObject() {
+               NodeTypeInfoToUpdateArtifacts nodeTypeInfoToUpdateArtifacts = new NodeTypeInfoToUpdateArtifacts(NAME,
+                       NODE_TYPES_ARTIFACTS_TO_HANDLE);
+               assertThat(nodeTypeInfoToUpdateArtifacts.getNodeName(), is(NAME));
+               assertThat(nodeTypeInfoToUpdateArtifacts.getNodeTypesArtifactsToHandle(), is(NODE_TYPES_ARTIFACTS_TO_HANDLE));
        }
 }
\ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipListTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipListTest.java
new file mode 100644 (file)
index 0000000..ac657dd
--- /dev/null
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. 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.openecomp.sdc.be.info;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+
+public class RelationshipListTest {
+
+    @Test
+    public void shouldHaveValidDefaultConstructor() {
+        assertThat(RelationshipList.class, hasValidBeanConstructor());
+    }
+
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(RelationshipList.class, hasValidGettersAndSetters());
+    }
+
+}
\ No newline at end of file