diff options
author | Dmitry Puzikov <d.puzikov2@partner.samsung.com> | 2020-03-23 17:27:25 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-24 08:34:33 +0000 |
commit | 91ac6b9f294828bec7e8e9200f5dabaf64f2a4f3 (patch) | |
tree | fcf3cdbd2b570c129b72c42708df40fc99af0a92 /catalog-be/src/test/java | |
parent | 8448309e0e1aed102a34bafbb53b1fd9b9600bfe (diff) |
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 <d.puzikov2@partner.samsung.com>
Diffstat (limited to 'catalog-be/src/test/java')
9 files changed, 52 insertions, 910 deletions
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<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getContacts(); - } - - - @Test - public void testSetContacts() throws Exception { - ProductAssetMetadata testSubject; - List<String> contacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setContacts(contacts); - } - - - @Test - public void testGetProductGroupings() throws Exception { - ProductAssetMetadata testSubject; - List<ProductCategoryGroupMetadata> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProductGroupings(); - } - - - @Test - public void testSetProductGroupings() throws Exception { - ProductAssetMetadata testSubject; - List<ProductCategoryGroupMetadata> 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<ResourceInstanceMetadata> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResources(); - } - - - @Test - public void testSetResources() throws Exception { - ResourceAssetDetailedMetadata testSubject; - List<ResourceInstanceMetadata> resources = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResources(resources); - } - - - @Test - public void testGetArtifacts() throws Exception { - ResourceAssetDetailedMetadata testSubject; - List<ArtifactMetadata> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetArtifacts() throws Exception { - ResourceAssetDetailedMetadata testSubject; - List<ArtifactMetadata> 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<ArtifactMetadata> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetArtifacts() throws Exception { + public void testGetResourceInstanceName() { ResourceInstanceMetadata testSubject; - List<ArtifactMetadata> 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<ResourceInstanceMetadata> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResources(); - } - - - @Test - public void testSetResources() throws Exception { - ServiceAssetDetailedMetadata testSubject; - List<ResourceInstanceMetadata> resources = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResources(resources); - } - - - @Test - public void testGetArtifacts() throws Exception { - ServiceAssetDetailedMetadata testSubject; - List<ArtifactMetadata> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetArtifacts() throws Exception { - ServiceAssetDetailedMetadata testSubject; - List<ArtifactMetadata> 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); } } |