openecomp-be code coverage increase 00/94800/2
authorPiotr Darosz <piotr.darosz@nokia.com>
Tue, 3 Sep 2019 07:14:35 +0000 (09:14 +0200)
committerTomasz Golabek <tomasz.golabek@nokia.com>
Tue, 3 Sep 2019 08:06:20 +0000 (08:06 +0000)
Add tests for classes in generator.datatypes.tosca package

Change-Id: Ic21b4e05d15e881016fa5f25113625bc441924c9
Issue-ID: SDC-2326
Signed-off-by: Piotr Darosz <piotr.darosz@nokia.com>
12 files changed:
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavorTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModelTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavorTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImageTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfoTest.java [new file with mode: 0644]
openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java
openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java
openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java
openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java
openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java
openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java

diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavorTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavorTest.java
new file mode 100644 (file)
index 0000000..08fcd5d
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.sdc.generator.datatypes.tosca;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+public class ComputeFlavorTest {
+    @Test
+    public void accessorsTest() {
+        assertThat(ComputeFlavor.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void equalsTest() {
+        assertThat(ComputeFlavor.class, hasValidBeanEquals());
+    }
+
+    @Test
+    public void hashCodeTest() {
+        assertThat(ComputeFlavor.class, hasValidBeanHashCode());
+    }
+
+    @Test
+    public void toStringTest() {
+        assertThat(ComputeFlavor.class, hasValidBeanToString());
+    }
+}
\ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModelTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModelTest.java
new file mode 100644 (file)
index 0000000..e26c11f
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.sdc.generator.datatypes.tosca;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+public class DeploymentFlavorModelTest {
+    @Test
+    public void accessorsTest() {
+        assertThat(DeploymentFlavorModel.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void equalsTest() {
+        assertThat(DeploymentFlavorModel.class, hasValidBeanEquals());
+    }
+
+    @Test
+    public void hashCodeTest() {
+        assertThat(DeploymentFlavorModel.class, hasValidBeanHashCode());
+    }
+
+    @Test
+    public void toStringTest() {
+        assertThat(DeploymentFlavorModel.class, hasValidBeanToString());
+    }
+}
\ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavorTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavorTest.java
new file mode 100644 (file)
index 0000000..28e0f23
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.sdc.generator.datatypes.tosca;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+public class LicenseFlavorTest {
+    @Test
+    public void accessorsTest() {
+        assertThat(LicenseFlavor.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void equalsTest() {
+        assertThat(LicenseFlavor.class, hasValidBeanEquals());
+    }
+
+    @Test
+    public void hashCodeTest() {
+        assertThat(LicenseFlavor.class, hasValidBeanHashCode());
+    }
+
+    @Test
+    public void toStringTest() {
+        assertThat(LicenseFlavor.class, hasValidBeanToString());
+    }
+}
\ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImageTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImageTest.java
new file mode 100644 (file)
index 0000000..20f2878
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.sdc.generator.datatypes.tosca;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+public class MultiFlavorVfcImageTest {
+    @Test
+    public void accessorsTest() {
+        assertThat(MultiFlavorVfcImage.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void equalsTest() {
+        assertThat(MultiFlavorVfcImage.class, hasValidBeanEquals());
+    }
+
+    @Test
+    public void hashCodeTest() {
+        assertThat(MultiFlavorVfcImage.class, hasValidBeanHashCode());
+    }
+
+    @Test
+    public void toStringTest() {
+        assertThat(MultiFlavorVfcImage.class, hasValidBeanToString());
+    }
+}
\ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfoTest.java
new file mode 100644 (file)
index 0000000..0cd6985
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.sdc.generator.datatypes.tosca;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+public class VendorInfoTest {
+    @Test
+    public void accessorsTest() {
+        assertThat(VendorInfo.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void equalsTest() {
+        assertThat(VendorInfo.class, hasValidBeanEquals());
+    }
+
+    @Test
+    public void hashCodeTest() {
+        assertThat(VendorInfo.class, hasValidBeanHashCode());
+    }
+
+    @Test
+    public void toStringTest() {
+        assertThat(VendorInfo.class, hasValidBeanToString());
+    }
+}
\ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfoTest.java
new file mode 100644 (file)
index 0000000..0b7f2dd
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.sdc.generator.datatypes.tosca;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+public class VspModelInfoTest {
+    @Test
+    public void accessorsTest() {
+        assertThat(VspModelInfo.class, hasValidGettersAndSetters());
+    }
+
+    @Test
+    public void equalsTest() {
+        assertThat(VspModelInfo.class, hasValidBeanEquals());
+    }
+
+    @Test
+    public void hashCodeTest() {
+        assertThat(VspModelInfo.class, hasValidBeanHashCode());
+    }
+
+    @Test
+    public void toStringTest() {
+        assertThat(VspModelInfo.class, hasValidBeanToString());
+    }
+}
\ No newline at end of file
index 5edb29c..4c3e1a6 100644 (file)
@@ -16,6 +16,8 @@
  * 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.generator.datatypes.tosca;
@@ -61,10 +63,10 @@ public class ComputeFlavor {
   public boolean equals(Object obj) {
     if (this == obj)
       return true;
-    if (obj != null && getClass() != obj.getClass())
+    if (obj == null || getClass() != obj.getClass())
       return false;
     ComputeFlavor other = (ComputeFlavor) obj;
-    if(other != null) {
+
       if (num_cpus != other.num_cpus)
         return false;
       if (this.disk_size == null) {
@@ -77,7 +79,7 @@ public class ComputeFlavor {
           return false;
       } else if (!mem_size.equals(other.mem_size))
         return false;
-    }
+
     return true;
   }
 
index 62705a2..2474c1b 100644 (file)
@@ -16,6 +16,8 @@
  * 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.generator.datatypes.tosca;
@@ -73,10 +75,10 @@ public class DeploymentFlavorModel {
   public boolean equals(Object obj) {
     if (this == obj)
       return true;
-    if (obj != null && getClass() != obj.getClass())
+    if (obj == null || getClass() != obj.getClass())
       return false;
     DeploymentFlavorModel other = (DeploymentFlavorModel) obj;
-    if (other != null) {
+
       if (this.sp_part_number == null) {
         if (other.sp_part_number != null)
           return false;
@@ -97,7 +99,7 @@ public class DeploymentFlavorModel {
           return false;
       } else if (!license_flavor.equals(other.license_flavor))
         return false;
-    }
+
     return true;
   }
 
index 2a1b765..b7f9dd8 100644 (file)
@@ -16,6 +16,8 @@
  * 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.generator.datatypes.tosca;
@@ -44,16 +46,16 @@ public class LicenseFlavor {
   public boolean equals(Object obj) {
     if (this == obj)
       return true;
-    if (obj != null && getClass() != obj.getClass())
+    if (obj == null || getClass() != obj.getClass())
       return false;
     LicenseFlavor other = (LicenseFlavor) obj;
-    if (other != null) {
+
       if (this.feature_group_uuid == null) {
         if (other.feature_group_uuid != null)
           return false;
       } else if (!feature_group_uuid.equals(other.feature_group_uuid))
         return false;
-    }
+
     return true;
   }
 
index ac5e4c0..d6620ce 100644 (file)
@@ -16,6 +16,8 @@
  * 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.generator.datatypes.tosca;
@@ -74,10 +76,10 @@ public class MultiFlavorVfcImage {
   public boolean equals(Object obj) {
     if (this == obj)
       return true;
-    if (obj != null && getClass() != obj.getClass())
+    if (obj == null || getClass() != obj.getClass())
       return false;
     MultiFlavorVfcImage other = (MultiFlavorVfcImage) obj;
-    if (other != null) {
+
       if (this.file_name == null) {
         if (other.file_name != null)
           return false;
@@ -98,7 +100,7 @@ public class MultiFlavorVfcImage {
           return false;
       } else if (!software_version.equals(other.software_version))
         return false;
-    }
+
     return true;
   }
 
index 821549f..d8d8cb6 100644 (file)
@@ -16,6 +16,8 @@
  * 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.generator.datatypes.tosca;
@@ -52,10 +54,10 @@ public class VendorInfo {
   public boolean equals(Object obj) {
     if (this == obj)
       return true;
-    if (obj != null && getClass() != obj.getClass())
+    if (obj == null || getClass() != obj.getClass())
       return false;
     VendorInfo other = (VendorInfo) obj;
-    if (other != null) {
+
       if (this.manufacturer_reference_number == null) {
         if (other.manufacturer_reference_number != null)
           return false;
@@ -66,7 +68,7 @@ public class VendorInfo {
           return false;
       } else if (!vendor_model.equals(other.vendor_model))
         return false;
-    }
+
     return true;
   }
 
index 7349edb..1eb1b32 100644 (file)
@@ -16,6 +16,8 @@
  * 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.generator.datatypes.tosca;
@@ -102,11 +104,11 @@ public class VspModelInfo {
     if (this == obj) {
       return true;
     }
-    if (obj != null && getClass() != obj.getClass()) {
+    if (obj == null || getClass() != obj.getClass()) {
       return false;
     }
     VspModelInfo other = (VspModelInfo) obj;
-    if(other != null) {
+
       if (this.releaseVendor == null) {
         if (other.releaseVendor != null) {
           return false;
@@ -149,7 +151,7 @@ public class VspModelInfo {
       } else if (!nics.equals(other.nics)) {
         return false;
       }
-    }
+
     return true;
   }
 }