From 587e939a4248e3e5a53b84b9d263c5c47bc6bbc0 Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Tue, 3 Sep 2019 09:14:35 +0200 Subject: openecomp-be code coverage increase Add tests for classes in generator.datatypes.tosca package Change-Id: Ic21b4e05d15e881016fa5f25113625bc441924c9 Issue-ID: SDC-2326 Signed-off-by: Piotr Darosz --- .../openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java | 8 +++++--- .../sdc/generator/datatypes/tosca/DeploymentFlavorModel.java | 8 +++++--- .../openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java | 8 +++++--- .../sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java | 8 +++++--- .../org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java | 8 +++++--- .../org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java | 8 +++++--- 6 files changed, 30 insertions(+), 18 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-tosca-generator-lib') diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java index 5edb29c74a..4c3e1a6a7a 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java index 62705a28b6..2474c1b6d8 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java index 2a1b765767..b7f9dd87da 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java index ac5e4c0bcb..d6620ce5c8 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java index 821549f0ac..d8d8cb6f8c 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java @@ -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; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java index 7349edb4e5..1eb1b32073 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java @@ -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; } } -- cgit 1.2.3-korg