From 91ac6b9f294828bec7e8e9200f5dabaf64f2a4f3 Mon Sep 17 00:00:00 2001 From: Dmitry Puzikov Date: Mon, 23 Mar 2020 17:27:25 +0100 Subject: Fix unit tests Add asserts where required, fix tiny issues. Replace DTO getters-setters with Lombok anntations. Change-Id: I77c7ff2b1b536e357910ab1820ff27e03a16967a Issue-ID: SDC-2849 Signed-off-by: Dmitry Puzikov --- .../servlet/representation/ArtifactMetadata.java | 94 +------- .../representation/ProductAssetMetadata.java | 47 +--- .../ProductCategoryGroupMetadata.java | 37 +--- .../ResourceAssetDetailedMetadata.java | 45 +--- .../representation/ResourceAssetMetadata.java | 45 +--- .../representation/ResourceInstanceMetadata.java | 60 +----- .../ServiceAssetDetailedMetadata.java | 28 +-- .../representation/ServiceAssetMetadata.java | 37 +--- .../ServiceDistributionRespInfo.java | 25 +-- .../representation/ArtifactMetadataTest.java | 239 +-------------------- .../representation/ProductAssetMetadataTest.java | 107 +-------- .../ProductCategoryGroupMetadataTest.java | 73 ++----- .../ResourceAssetDetailedMetadataTest.java | 106 +-------- .../representation/ResourceAssetMetadataTest.java | 106 +-------- .../ResourceInstanceMetadataTest.java | 150 +------------ .../ServiceAssetDetailedMetadataTest.java | 60 +----- .../representation/ServiceAssetMetadataTest.java | 84 +------- .../ServiceDistributionRespInfoTest.java | 37 ++-- 18 files changed, 100 insertions(+), 1280 deletions(-) (limited to 'catalog-be') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadata.java index e41d8d7548..7b68ffeee7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadata.java @@ -20,6 +20,11 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class ArtifactMetadata { private String artifactName; private String artifactType; @@ -32,93 +37,4 @@ public class ArtifactMetadata { private String generatedFromUUID; private String artifactLabel; private String artifactGroupType; - - public String getArtifactName() { - return artifactName; - } - - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - public String getArtifactURL() { - return artifactURL; - } - - public void setArtifactURL(String artifactURL) { - this.artifactURL = artifactURL; - } - - public String getArtifactDescription() { - return artifactDescription; - } - - public void setArtifactDescription(String artifactDescription) { - this.artifactDescription = artifactDescription; - } - - public Integer getArtifactTimeout() { - return artifactTimeout; - } - - public void setArtifactTimeout(Integer artifactTimeout) { - this.artifactTimeout = artifactTimeout; - } - - public String getArtifactChecksum() { - return artifactChecksum; - } - - public void setArtifactChecksum(String artifactChecksum) { - this.artifactChecksum = artifactChecksum; - } - - public String getArtifactUUID() { - return artifactUUID; - } - - public void setArtifactUUID(String artifactUUID) { - this.artifactUUID = artifactUUID; - } - - public String getArtifactVersion() { - return artifactVersion; - } - - public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - } - - public String getGeneratedFromUUID() { - return generatedFromUUID; - } - - public void setGeneratedFromUUID(String generatedFromUUID) { - this.generatedFromUUID = generatedFromUUID; - } - - public String getArtifactLabel() { - return artifactLabel; - } - - public void setArtifactLabel(String artifactLabel) { - this.artifactLabel = artifactLabel; - } - - public String getArtifactGroupType() { - return artifactGroupType; - } - - public void setArtifactGroupType(String artifactGroupType) { - this.artifactGroupType = artifactGroupType; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadata.java index 40b78c12d3..90801afa4a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadata.java @@ -21,52 +21,15 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ProductAssetMetadata extends AssetMetadata { private String lifecycleState; private String lastUpdaterUserId; - private boolean isActive; + private boolean active; private List contacts; private List productGroupings; - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public boolean isActive() { - return isActive; - } - - public void setActive(boolean isActive) { - this.isActive = isActive; - } - - public List getContacts() { - return contacts; - } - - public void setContacts(List contacts) { - this.contacts = contacts; - } - - public List getProductGroupings() { - return productGroupings; - } - - public void setProductGroupings(List productGroupings) { - this.productGroupings = productGroupings; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadata.java index 7d666df703..28137063e2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadata.java @@ -20,38 +20,15 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor public class ProductCategoryGroupMetadata { private String category; private String subCategory; private String group; - - public ProductCategoryGroupMetadata(String category, String subCategory, String group) { - this.category = category; - this.subCategory = subCategory; - this.group = group; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getSubCategory() { - return subCategory; - } - - public void setSubCategory(String subCategory) { - this.subCategory = subCategory; - } - - public String getGroup() { - return group; - } - - public void setGroup(String group) { - this.group = group; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadata.java index eb15e077de..0e50c4dafa 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadata.java @@ -21,7 +21,11 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ResourceAssetDetailedMetadata extends ResourceAssetMetadata { private String lastUpdaterFullName; @@ -29,45 +33,4 @@ public class ResourceAssetDetailedMetadata extends ResourceAssetMetadata { private List resources; private List artifacts; private String description; - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public String getToscaResourceName() { - return toscaResourceName; - } - - public void setToscaResourceName(String toscaResourceName) { - this.toscaResourceName = toscaResourceName; - } - - public List getResources() { - return resources; - } - - public void setResources(List resources) { - this.resources = resources; - } - - public List getArtifacts() { - return artifacts; - } - - public void setArtifacts(List artifactMetaList) { - this.artifacts = artifactMetaList; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadata.java index 455e125ffc..a75335aaa1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadata.java @@ -20,50 +20,15 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class ResourceAssetMetadata extends AssetMetadata { private String category; private String subCategory; private String resourceType; private String lifecycleState; private String lastUpdaterUserId; - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getSubCategory() { - return subCategory; - } - - public void setSubCategory(String subCategory) { - this.subCategory = subCategory; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadata.java index 1023f82249..da2a9ec466 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadata.java @@ -21,7 +21,11 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ResourceInstanceMetadata { private String resourceInstanceName; private String resourceName; @@ -30,60 +34,4 @@ public class ResourceInstanceMetadata { private String resoucreType; private String resourceUUID; private List artifacts; - - public String getResourceInstanceName() { - return resourceInstanceName; - } - - public void setResourceInstanceName(String resourceInstanceName) { - this.resourceInstanceName = resourceInstanceName; - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceInvariantUUID() { - return resourceInvariantUUID; - } - - public void setResourceInvariantUUID(String resourceInvariantUUID) { - this.resourceInvariantUUID = resourceInvariantUUID; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public String getResoucreType() { - return resoucreType; - } - - public void setResoucreType(String resoucreType) { - this.resoucreType = resoucreType; - } - - public String getResourceUUID() { - return resourceUUID; - } - - public void setResourceUUID(String resourceUUID) { - this.resourceUUID = resourceUUID; - } - - public List getArtifacts() { - return artifacts; - } - - public void setArtifacts(List artifacts) { - this.artifacts = artifacts; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadata.java index e677fdc190..cc4e39878a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadata.java @@ -21,33 +21,13 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ServiceAssetDetailedMetadata extends ServiceAssetMetadata { private String lastUpdaterFullName; private List resources; private List artifacts; - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public List getResources() { - return resources; - } - - public void setResources(List resources) { - this.resources = resources; - } - - public List getArtifacts() { - return artifacts; - } - - public void setArtifacts(List artifacts) { - this.artifacts = artifacts; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadata.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadata.java index 6e5ac8426c..3308343d94 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadata.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadata.java @@ -20,41 +20,14 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class ServiceAssetMetadata extends AssetMetadata { private String category; private String lifecycleState; private String lastUpdaterUserId; private String distributionStatus; - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public String getDistributionStatus() { - return distributionStatus; - } - - public void setDistributionStatus(String distributionStatus) { - this.distributionStatus = distributionStatus; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfo.java index c5e1a42290..1ba33ad257 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfo.java @@ -20,25 +20,18 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + /** * Created by chaya on 10/26/2017. */ +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor public class ServiceDistributionRespInfo { - private String distributionId; - - public ServiceDistributionRespInfo() { - } - - public ServiceDistributionRespInfo(String distributionId) { - this.distributionId = distributionId; - } - - public String getDistributionId() { - return distributionId; - } - - public void setDistributionId(String distributionId) { - this.distributionId = distributionId; - } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadataTest.java index 9edb77324d..a28f61941d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ArtifactMetadataTest.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; @@ -29,245 +31,12 @@ public class ArtifactMetadataTest { return new ArtifactMetadata(); } - - @Test - public void testGetArtifactName() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactName(); - } - - - @Test - public void testSetArtifactName() throws Exception { - ArtifactMetadata testSubject; - String artifactName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactName(artifactName); - } - - - @Test - public void testGetArtifactType() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactType(); - } - - - @Test - public void testSetArtifactType() throws Exception { - ArtifactMetadata testSubject; - String artifactType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactType(artifactType); - } - - - @Test - public void testGetArtifactURL() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactURL(); - } - - - @Test - public void testSetArtifactURL() throws Exception { - ArtifactMetadata testSubject; - String artifactURL = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactURL(artifactURL); - } - - - @Test - public void testGetArtifactDescription() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactDescription(); - } - - - @Test - public void testSetArtifactDescription() throws Exception { - ArtifactMetadata testSubject; - String artifactDescription = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactDescription(artifactDescription); - } - - - @Test - public void testGetArtifactTimeout() throws Exception { - ArtifactMetadata testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactTimeout(); - } - - - @Test - public void testSetArtifactTimeout() throws Exception { - ArtifactMetadata testSubject; - Integer artifactTimeout = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactTimeout(artifactTimeout); - } - - - @Test - public void testGetArtifactChecksum() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactChecksum(); - } - - - @Test - public void testSetArtifactChecksum() throws Exception { - ArtifactMetadata testSubject; - String artifactChecksum = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactChecksum(artifactChecksum); - } - - - @Test - public void testGetArtifactUUID() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactUUID(); - } - - - @Test - public void testSetArtifactUUID() throws Exception { - ArtifactMetadata testSubject; - String artifactUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactUUID(artifactUUID); - } - - - @Test - public void testGetArtifactVersion() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactVersion(); - } - - - @Test - public void testSetArtifactVersion() throws Exception { - ArtifactMetadata testSubject; - String artifactVersion = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactVersion(artifactVersion); - } - - - @Test - public void testGetGeneratedFromUUID() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGeneratedFromUUID(); - } - - - @Test - public void testSetGeneratedFromUUID() throws Exception { - ArtifactMetadata testSubject; - String generatedFromUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setGeneratedFromUUID(generatedFromUUID); - } - - - @Test - public void testGetArtifactLabel() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactLabel(); - } - - - @Test - public void testSetArtifactLabel() throws Exception { - ArtifactMetadata testSubject; - String artifactLabel = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactLabel(artifactLabel); - } - - - @Test - public void testGetArtifactGroupType() throws Exception { - ArtifactMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactGroupType(); - } - - @Test - public void testSetArtifactGroupType() throws Exception { + public void testArtifactNameInstance() throws Exception { ArtifactMetadata testSubject; - String artifactGroupType = ""; // default test testSubject = createTestSubject(); - testSubject.setArtifactGroupType(artifactGroupType); + assertThat(testSubject).isInstanceOf(ArtifactMetadata.class); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadataTest.java index 615c8e7e4f..8fd500dad5 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductAssetMetadataTest.java @@ -20,10 +20,9 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; -import org.junit.Test; - -import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; public class ProductAssetMetadataTest { @@ -35,109 +34,9 @@ public class ProductAssetMetadataTest { @Test public void testGetLifecycleState() throws Exception { ProductAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLifecycleState(); - } - - - @Test - public void testSetLifecycleState() throws Exception { - ProductAssetMetadata testSubject; - String lifecycleState = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLifecycleState(lifecycleState); - } - - - @Test - public void testGetLastUpdaterUserId() throws Exception { - ProductAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterUserId(); - } - - - @Test - public void testSetLastUpdaterUserId() throws Exception { - ProductAssetMetadata testSubject; - String lastUpdaterUserId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterUserId(lastUpdaterUserId); - } - - - @Test - public void testIsActive() throws Exception { - ProductAssetMetadata testSubject; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isActive(); - } - - - @Test - public void testSetActive() throws Exception { - ProductAssetMetadata testSubject; - boolean isActive = false; - - // default test - testSubject = createTestSubject(); - testSubject.setActive(isActive); - } - - - @Test - public void testGetContacts() throws Exception { - ProductAssetMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getContacts(); - } - - - @Test - public void testSetContacts() throws Exception { - ProductAssetMetadata testSubject; - List contacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setContacts(contacts); - } - - - @Test - public void testGetProductGroupings() throws Exception { - ProductAssetMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProductGroupings(); - } - - - @Test - public void testSetProductGroupings() throws Exception { - ProductAssetMetadata testSubject; - List productGroupings = null; // default test testSubject = createTestSubject(); - testSubject.setProductGroupings(productGroupings); + assertThat(testSubject).isInstanceOf(ProductAssetMetadata.class); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadataTest.java index 09d0821b46..4985f4ce55 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ProductCategoryGroupMetadataTest.java @@ -20,78 +20,31 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; public class ProductCategoryGroupMetadataTest { - private ProductCategoryGroupMetadata createTestSubject() { - return new ProductCategoryGroupMetadata("", "", ""); - } - - - @Test - public void testGetCategory() throws Exception { - ProductCategoryGroupMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCategory(); - } - - - @Test - public void testSetCategory() throws Exception { - ProductCategoryGroupMetadata testSubject; - String category = ""; + private static final String category = "mock-category"; + private static final String subCategory = "mock-sub-category"; + private static final String group = "mock-group"; - // default test - testSubject = createTestSubject(); - testSubject.setCategory(category); - } - - - @Test - public void testGetSubCategory() throws Exception { - ProductCategoryGroupMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSubCategory(); - } - - - @Test - public void testSetSubCategory() throws Exception { - ProductCategoryGroupMetadata testSubject; - String subCategory = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setSubCategory(subCategory); - } - - - @Test - public void testGetGroup() throws Exception { - ProductCategoryGroupMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGroup(); + private ProductCategoryGroupMetadata createTestSubject() { + return new ProductCategoryGroupMetadata(category, subCategory, group); } - @Test - public void testSetGroup() throws Exception { + public void testProductCategoryGroupMetadataConstructor() { ProductCategoryGroupMetadata testSubject; - String group = ""; // default test testSubject = createTestSubject(); - testSubject.setGroup(group); + assertThat(testSubject) + .isInstanceOf(ProductCategoryGroupMetadata.class) + .hasFieldOrPropertyWithValue("category", category) + .hasFieldOrPropertyWithValue("subCategory", subCategory) + .hasFieldOrPropertyWithValue("group", group); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadataTest.java index a8a84a36e7..f1f7d73406 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetDetailedMetadataTest.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; import java.util.List; @@ -32,111 +34,11 @@ public class ResourceAssetDetailedMetadataTest { @Test - public void testGetLastUpdaterFullName() throws Exception { - ResourceAssetDetailedMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterFullName(); - } - - - @Test - public void testSetLastUpdaterFullName() throws Exception { - ResourceAssetDetailedMetadata testSubject; - String lastUpdaterFullName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterFullName(lastUpdaterFullName); - } - - - @Test - public void testGetToscaResourceName() throws Exception { - ResourceAssetDetailedMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaResourceName(); - } - - - @Test - public void testSetToscaResourceName() throws Exception { - ResourceAssetDetailedMetadata testSubject; - String toscaResourceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaResourceName(toscaResourceName); - } - - - @Test - public void testGetResources() throws Exception { - ResourceAssetDetailedMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResources(); - } - - - @Test - public void testSetResources() throws Exception { - ResourceAssetDetailedMetadata testSubject; - List resources = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResources(resources); - } - - - @Test - public void testGetArtifacts() throws Exception { - ResourceAssetDetailedMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetArtifacts() throws Exception { - ResourceAssetDetailedMetadata testSubject; - List artifactMetaList = null; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifacts(artifactMetaList); - } - - - @Test - public void testGetDescription() throws Exception { - ResourceAssetDetailedMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testSetDescription() throws Exception { + public void testGetLastUpdaterFullName() { ResourceAssetDetailedMetadata testSubject; - String description = ""; // default test testSubject = createTestSubject(); - testSubject.setDescription(description); + assertThat(testSubject).isInstanceOf(ResourceAssetDetailedMetadata.class); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadataTest.java index 6f36dede73..f1770b1208 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceAssetMetadataTest.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; @@ -31,111 +33,11 @@ public class ResourceAssetMetadataTest { @Test - public void testGetCategory() throws Exception { - ResourceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCategory(); - } - - - @Test - public void testSetCategory() throws Exception { - ResourceAssetMetadata testSubject; - String category = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCategory(category); - } - - - @Test - public void testGetSubCategory() throws Exception { - ResourceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSubCategory(); - } - - - @Test - public void testSetSubCategory() throws Exception { - ResourceAssetMetadata testSubject; - String subCategory = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setSubCategory(subCategory); - } - - - @Test - public void testGetResourceType() throws Exception { - ResourceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceType(); - } - - - @Test - public void testSetResourceType() throws Exception { - ResourceAssetMetadata testSubject; - String resourceType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceType(resourceType); - } - - - @Test - public void testGetLifecycleState() throws Exception { - ResourceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLifecycleState(); - } - - - @Test - public void testSetLifecycleState() throws Exception { - ResourceAssetMetadata testSubject; - String lifecycleState = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLifecycleState(lifecycleState); - } - - - @Test - public void testGetLastUpdaterUserId() throws Exception { - ResourceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterUserId(); - } - - - @Test - public void testSetLastUpdaterUserId() throws Exception { + public void testGetCategory() { ResourceAssetMetadata testSubject; - String lastUpdaterUserId = ""; // default test testSubject = createTestSubject(); - testSubject.setLastUpdaterUserId(lastUpdaterUserId); + assertThat(testSubject).isInstanceOf(ResourceAssetMetadata.class); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadataTest.java index 35f2a4fa6f..24d40e84b2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ResourceInstanceMetadataTest.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; import java.util.List; @@ -33,155 +35,11 @@ public class ResourceInstanceMetadataTest { @Test - public void testGetResourceInstanceName() throws Exception { - ResourceInstanceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceInstanceName(); - } - - - @Test - public void testSetResourceInstanceName() throws Exception { - ResourceInstanceMetadata testSubject; - String resourceInstanceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceInstanceName(resourceInstanceName); - } - - - @Test - public void testGetResourceName() throws Exception { - ResourceInstanceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceName(); - } - - - @Test - public void testSetResourceName() throws Exception { - ResourceInstanceMetadata testSubject; - String resourceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceName(resourceName); - } - - - @Test - public void testGetResourceInvariantUUID() throws Exception { - ResourceInstanceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceInvariantUUID(); - } - - - @Test - public void testSetResourceInvariantUUID() throws Exception { - ResourceInstanceMetadata testSubject; - String resourceInvariantUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceInvariantUUID(resourceInvariantUUID); - } - - - @Test - public void testGetResourceVersion() throws Exception { - ResourceInstanceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceVersion(); - } - - - @Test - public void testSetResourceVersion() throws Exception { - ResourceInstanceMetadata testSubject; - String resourceVersion = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceVersion(resourceVersion); - } - - - @Test - public void testGetResoucreType() throws Exception { - ResourceInstanceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResoucreType(); - } - - - @Test - public void testSetResoucreType() throws Exception { - ResourceInstanceMetadata testSubject; - String resoucreType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResoucreType(resoucreType); - } - - - @Test - public void testGetResourceUUID() throws Exception { - ResourceInstanceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceUUID(); - } - - - @Test - public void testSetResourceUUID() throws Exception { - ResourceInstanceMetadata testSubject; - String resourceUUID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceUUID(resourceUUID); - } - - - @Test - public void testGetArtifacts() throws Exception { - ResourceInstanceMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetArtifacts() throws Exception { + public void testGetResourceInstanceName() { ResourceInstanceMetadata testSubject; - List artifacts = null; // default test testSubject = createTestSubject(); - testSubject.setArtifacts(artifacts); + assertThat(testSubject).isInstanceOf(ResourceInstanceMetadata.class); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadataTest.java index 093f0fc4ce..eba5113843 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetDetailedMetadataTest.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; import java.util.List; @@ -35,65 +37,9 @@ public class ServiceAssetDetailedMetadataTest { @Test public void testGetLastUpdaterFullName() throws Exception { ServiceAssetDetailedMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterFullName(); - } - - - @Test - public void testSetLastUpdaterFullName() throws Exception { - ServiceAssetDetailedMetadata testSubject; - String lastUpdaterFullName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterFullName(lastUpdaterFullName); - } - - - @Test - public void testGetResources() throws Exception { - ServiceAssetDetailedMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResources(); - } - - - @Test - public void testSetResources() throws Exception { - ServiceAssetDetailedMetadata testSubject; - List resources = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResources(resources); - } - - - @Test - public void testGetArtifacts() throws Exception { - ServiceAssetDetailedMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetArtifacts() throws Exception { - ServiceAssetDetailedMetadata testSubject; - List artifacts = null; // default test testSubject = createTestSubject(); - testSubject.setArtifacts(artifacts); + assertThat(testSubject).isInstanceOf(ServiceAssetDetailedMetadata.class); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadataTest.java index d84246ae34..8fbe26009e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadataTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceAssetMetadataTest.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; @@ -31,89 +33,11 @@ public class ServiceAssetMetadataTest { @Test - public void testGetCategory() throws Exception { - ServiceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCategory(); - } - - - @Test - public void testSetCategory() throws Exception { - ServiceAssetMetadata testSubject; - String category = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCategory(category); - } - - - @Test - public void testGetLifecycleState() throws Exception { - ServiceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLifecycleState(); - } - - - @Test - public void testSetLifecycleState() throws Exception { - ServiceAssetMetadata testSubject; - String lifecycleState = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLifecycleState(lifecycleState); - } - - - @Test - public void testGetLastUpdaterUserId() throws Exception { - ServiceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterUserId(); - } - - - @Test - public void testSetLastUpdaterUserId() throws Exception { - ServiceAssetMetadata testSubject; - String lastUpdaterUserId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterUserId(lastUpdaterUserId); - } - - - @Test - public void testGetDistributionStatus() throws Exception { - ServiceAssetMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDistributionStatus(); - } - - - @Test - public void testSetDistributionStatus() throws Exception { + public void testGetCategory() { ServiceAssetMetadata testSubject; - String distributionStatus = ""; // default test testSubject = createTestSubject(); - testSubject.setDistributionStatus(distributionStatus); + assertThat(testSubject).isInstanceOf(ServiceAssetMetadata.class); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfoTest.java index 8636db66a6..7851a9f5c6 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/representation/ServiceDistributionRespInfoTest.java @@ -20,36 +20,25 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; public class ServiceDistributionRespInfoTest { - - private ServiceDistributionRespInfo createTestSubject() { - return new ServiceDistributionRespInfo(); - } - @Test - public void testCtr() throws Exception { - new ServiceDistributionRespInfo("mock"); - } - - @Test - public void testGetDistributionId() throws Exception { - ServiceDistributionRespInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDistributionId(); + public void testCtrNoArgs(){ + ServiceDistributionRespInfo serviceDistributionRespInfo = new ServiceDistributionRespInfo(); + assertThat(serviceDistributionRespInfo) + .isInstanceOf(ServiceDistributionRespInfo.class) + .hasFieldOrPropertyWithValue("distributionId", null); } @Test - public void testSetDistributionId() throws Exception { - ServiceDistributionRespInfo testSubject; - String distributionId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDistributionId(distributionId); + public void testCtrAllArgs(){ + String distributionId = "mock-id"; + ServiceDistributionRespInfo serviceDistributionRespInfo = new ServiceDistributionRespInfo(distributionId); + assertThat(serviceDistributionRespInfo) + .isInstanceOf(ServiceDistributionRespInfo.class) + .hasFieldOrPropertyWithValue("distributionId", distributionId); } } -- cgit 1.2.3-korg