From 4f02f33f309c3869d231926582f559aa04816063 Mon Sep 17 00:00:00 2001 From: vasraz Date: Thu, 26 Mar 2020 14:20:02 +0000 Subject: Increase test coverage Change-Id: Ibc6134e5954537258541ff018dc9794191d4e907 Signed-off-by: Vasyl Razinkov Issue-ID: SDC-2833 --- .../sdc/be/ui/model/UIConstraintTest.java | 29 +- .../sdc/be/ui/model/UINodeFilterTest.java | 15 +- .../sdc/be/ui/model/UiCategoriesTest.java | 83 +--- .../sdc/be/ui/model/UiCombinationTest.java | 15 +- .../be/ui/model/UiComponentDataTransferTest.java | 448 +-------------------- .../be/ui/model/UiResourceDataTransferTest.java | 197 +-------- .../sdc/be/ui/model/UiResourceMetadataTest.java | 215 +--------- .../sdc/be/ui/model/UiServiceDataTransferTest.java | 61 +-- .../sdc/be/ui/model/UiServiceMetadataTest.java | 126 +----- 9 files changed, 111 insertions(+), 1078 deletions(-) (limited to 'catalog-model/src/test/java') diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java index e95fc85833..7fd473ada3 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java @@ -19,14 +19,33 @@ */ package org.openecomp.sdc.be.ui.model; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static org.hamcrest.MatcherAssert.assertThat; - +import org.assertj.core.api.Assertions; import org.junit.Test; public class UIConstraintTest { + + private UIConstraint createTestSubject() { + return new UIConstraint(); + } + @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(UIConstraint.class, hasValidGettersAndSetters()); + public void testCtor() throws Exception { + final UIConstraint testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UIConstraint.class); } + + @Test + public void testCtorX4() throws Exception { + final UIConstraint testSubject = + new UIConstraint("servicePropertyName", "constraintOperator", "sourceType", "value"); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UIConstraint.class); + } + + @Test + public void testCtorX5() throws Exception { + final UIConstraint testSubject = + new UIConstraint("servicePropertyName", "constraintOperator", "sourceType", "sourceName", "value"); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UIConstraint.class); + } + } \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java index 8f767fe418..0f3dc79563 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java @@ -19,14 +19,19 @@ */ package org.openecomp.sdc.be.ui.model; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static org.hamcrest.MatcherAssert.assertThat; - +import org.assertj.core.api.Assertions; import org.junit.Test; public class UINodeFilterTest { + + private UINodeFilter createTestSubject() { + return new UINodeFilter(); + } + @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(UINodeFilter.class, hasValidGettersAndSetters()); + public void testCtor() throws Exception { + final UINodeFilter testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UINodeFilter.class); } + } \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCategoriesTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCategoriesTest.java index 1108289a77..8e492d6462 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCategoriesTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCategoriesTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,81 +20,20 @@ package org.openecomp.sdc.be.ui.model; -import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; -import org.openecomp.sdc.be.model.category.CategoryDefinition; - public class UiCategoriesTest { - private UiCategories createTestSubject() { - return new UiCategories(); - } - - - @Test - public void testGetResourceCategories() throws Exception { - UiCategories testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceCategories(); - } - - - @Test - public void testSetResourceCategories() throws Exception { - UiCategories testSubject; - List resourceCategories = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceCategories(resourceCategories); - } - - - @Test - public void testGetServiceCategories() throws Exception { - UiCategories testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceCategories(); - } - - - @Test - public void testSetServiceCategories() throws Exception { - UiCategories testSubject; - List serviceCategories = null; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceCategories(serviceCategories); - } - - - @Test - public void testGetProductCategories() throws Exception { - UiCategories testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProductCategories(); - } + private UiCategories createTestSubject() { + return new UiCategories(); + } - - @Test - public void testSetProductCategories() throws Exception { - UiCategories testSubject; - List productCategories = null; + @Test + public void testCtor() throws Exception { + final UiCategories testSubject = createTestSubject(); + assertThat(testSubject).isNotNull().isInstanceOf(UiCategories.class); + } - // default test - testSubject = createTestSubject(); - testSubject.setProductCategories(productCategories); - } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java index 3bce3fd779..d34577a1e4 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java @@ -19,14 +19,19 @@ */ package org.openecomp.sdc.be.ui.model; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static org.hamcrest.MatcherAssert.assertThat; - +import org.assertj.core.api.Assertions; import org.junit.Test; public class UiCombinationTest { + + private UiCombination createTestSubject() { + return new UiCombination("NAME", "DESC"); + } + @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(UiCombination.class, hasValidGettersAndSetters()); + public void testCtor() throws Exception { + final UiCombination testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UiCombination.class); } + } \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransferTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransferTest.java index 758250dc7d..5a67f55979 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransferTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransferTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,445 +20,19 @@ package org.openecomp.sdc.be.ui.model; -import java.util.List; -import java.util.Map; - +import org.assertj.core.api.Assertions; import org.junit.Test; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.AdditionalInformationDefinition; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.CapabilityDefinition; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.ComponentInstanceInput; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import org.openecomp.sdc.be.model.RequirementDefinition; -import org.openecomp.sdc.be.model.category.CategoryDefinition; - public class UiComponentDataTransferTest { - private UiComponentDataTransfer createTestSubject() { - return new UiComponentDataTransfer(); - } - - - @Test - public void testGetArtifacts() throws Exception { - UiComponentDataTransfer testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifacts(); - } - - - @Test - public void testSetArtifacts() throws Exception { - UiComponentDataTransfer testSubject; - Map artifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifacts(artifacts); - } - - - @Test - public void testGetDeploymentArtifacts() throws Exception { - UiComponentDataTransfer testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDeploymentArtifacts(); - } - - - @Test - public void testSetDeploymentArtifacts() throws Exception { - UiComponentDataTransfer testSubject; - Map deploymentArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDeploymentArtifacts(deploymentArtifacts); - } - - - @Test - public void testGetToscaArtifacts() throws Exception { - UiComponentDataTransfer testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaArtifacts(); - } - - - @Test - public void testSetToscaArtifacts() throws Exception { - UiComponentDataTransfer testSubject; - Map toscaArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaArtifacts(toscaArtifacts); - } - - - @Test - public void testGetCategories() throws Exception { - UiComponentDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCategories(); - } - - - @Test - public void testSetCategories() throws Exception { - UiComponentDataTransfer testSubject; - List categories = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCategories(categories); - } - - - @Test - public void testGetCreatorUserId() throws Exception { - UiComponentDataTransfer testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCreatorUserId(); - } - - - @Test - public void testSetCreatorUserId() throws Exception { - UiComponentDataTransfer testSubject; - String creatorUserId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCreatorUserId(creatorUserId); - } - - - @Test - public void testGetCreatorFullName() throws Exception { - UiComponentDataTransfer testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCreatorFullName(); - } - - - @Test - public void testSetCreatorFullName() throws Exception { - UiComponentDataTransfer testSubject; - String creatorFullName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCreatorFullName(creatorFullName); - } - - - @Test - public void testGetLastUpdaterUserId() throws Exception { - UiComponentDataTransfer testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterUserId(); - } - - - @Test - public void testSetLastUpdaterUserId() throws Exception { - UiComponentDataTransfer testSubject; - String lastUpdaterUserId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterUserId(lastUpdaterUserId); - } - - - @Test - public void testGetLastUpdaterFullName() throws Exception { - UiComponentDataTransfer testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLastUpdaterFullName(); - } - - - @Test - public void testSetLastUpdaterFullName() throws Exception { - UiComponentDataTransfer testSubject; - String lastUpdaterFullName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLastUpdaterFullName(lastUpdaterFullName); - } - - - @Test - public void testGetComponentType() throws Exception { - UiComponentDataTransfer testSubject; - ComponentTypeEnum result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentType(); - } - - - @Test - public void testSetComponentType() throws Exception { - UiComponentDataTransfer testSubject; - ComponentTypeEnum componentType = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentType(componentType); - } - - - @Test - public void testGetComponentInstances() throws Exception { - UiComponentDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstances(); - } - - - @Test - public void testSetComponentInstances() throws Exception { - UiComponentDataTransfer testSubject; - List componentInstances = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentInstances(componentInstances); - } - - - @Test - public void testGetComponentInstancesRelations() throws Exception { - UiComponentDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstancesRelations(); - } - - - @Test - public void testSetComponentInstancesRelations() throws Exception { - UiComponentDataTransfer testSubject; - List componentInstancesRelations = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentInstancesRelations(componentInstancesRelations); - } - - - @Test - public void testGetComponentInstancesInputs() throws Exception { - UiComponentDataTransfer testSubject; - Map> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstancesInputs(); - } - - - @Test - public void testSetComponentInstancesInputs() throws Exception { - UiComponentDataTransfer testSubject; - Map> componentInstancesInputs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentInstancesInputs(componentInstancesInputs); - } - - - @Test - public void testGetComponentInstancesProperties() throws Exception { - UiComponentDataTransfer testSubject; - Map> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstancesProperties(); - } - - - @Test - public void testSetComponentInstancesProperties() throws Exception { - UiComponentDataTransfer testSubject; - Map> componentInstancesProperties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentInstancesProperties(componentInstancesProperties); - } - - - @Test - public void testGetComponentInstancesAttributes() throws Exception { - UiComponentDataTransfer testSubject; - Map> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstancesAttributes(); - } - - - @Test - public void testSetComponentInstancesAttributes() throws Exception { - UiComponentDataTransfer testSubject; - Map> componentInstancesAttributes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentInstancesAttributes(componentInstancesAttributes); - } - - - @Test - public void testGetCapabilities() throws Exception { - UiComponentDataTransfer testSubject; - Map> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilities(); - } - - - @Test - public void testSetCapabilities() throws Exception { - UiComponentDataTransfer testSubject; - Map> capabilities = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCapabilities(capabilities); - } - - - @Test - public void testGetRequirements() throws Exception { - UiComponentDataTransfer testSubject; - Map> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequirements(); - } - - - @Test - public void testSetRequirements() throws Exception { - UiComponentDataTransfer testSubject; - Map> requirements = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRequirements(requirements); - } - - - @Test - public void testGetInputs() throws Exception { - UiComponentDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInputs(); - } - - - @Test - public void testSetInputs() throws Exception { - UiComponentDataTransfer testSubject; - List inputs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInputs(inputs); - } - - - @Test - public void testGetGroups() throws Exception { - UiComponentDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGroups(); - } - - - @Test - public void testSetGroups() throws Exception { - UiComponentDataTransfer testSubject; - List groups = null; - - // default test - testSubject = createTestSubject(); - testSubject.setGroups(groups); - } - - - @Test - public void testGetAdditionalInformation() throws Exception { - UiComponentDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalInformation(); - } + private UiComponentDataTransfer createTestSubject() { + return new UiComponentDataTransfer(); + } - - @Test - public void testSetAdditionalInformation() throws Exception { - UiComponentDataTransfer testSubject; - List additionalInformation = null; + @Test + public void testCtor() throws Exception { + final UiComponentDataTransfer testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UiComponentDataTransfer.class); + } - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalInformation(additionalInformation); - } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransferTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransferTest.java index 55cd4e9eba..b44cbd017c 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransferTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransferTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,194 +20,19 @@ package org.openecomp.sdc.be.ui.model; -import java.util.List; -import java.util.Map; - +import org.assertj.core.api.Assertions; import org.junit.Test; -import org.openecomp.sdc.be.model.AdditionalInformationDefinition; -import org.openecomp.sdc.be.model.InterfaceDefinition; -import org.openecomp.sdc.be.model.PropertyDefinition; public class UiResourceDataTransferTest { - private UiResourceDataTransfer createTestSubject() { - return new UiResourceDataTransfer(); - } - - - @Test - public void testGetAdditionalInformation() throws Exception { - UiResourceDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalInformation(); - } - - - @Test - public void testSetAdditionalInformation() throws Exception { - UiResourceDataTransfer testSubject; - List additionalInformation = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalInformation(additionalInformation); - } - - - @Test - public void testGetMetadata() throws Exception { - UiResourceDataTransfer testSubject; - UiResourceMetadata result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMetadata(); - } - - - @Test - public void testSetMetadata() throws Exception { - UiResourceDataTransfer testSubject; - UiResourceMetadata metadata = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMetadata(metadata); - } - - - @Test - public void testGetDerivedFrom() throws Exception { - UiResourceDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDerivedFrom(); - } - - - @Test - public void testSetDerivedFrom() throws Exception { - UiResourceDataTransfer testSubject; - List derivedFrom = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDerivedFrom(derivedFrom); - } - - - @Test - public void testGetDerivedList() throws Exception { - UiResourceDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDerivedList(); - } - - - @Test - public void testSetDerivedList() throws Exception { - UiResourceDataTransfer testSubject; - List derivedList = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDerivedList(derivedList); - } - - - @Test - public void testGetProperties() throws Exception { - UiResourceDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProperties(); - } - - - @Test - public void testSetProperties() throws Exception { - UiResourceDataTransfer testSubject; - List properties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setProperties(properties); - } - - - @Test - public void testGetAttributes() throws Exception { - UiResourceDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAttributes(); - } - - - @Test - public void testSetAttributes() throws Exception { - UiResourceDataTransfer testSubject; - List attributes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAttributes(attributes); - } - - - @Test - public void testGetInterfaces() throws Exception { - UiResourceDataTransfer testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInterfaces(); - } - - - @Test - public void testSetInterfaces() throws Exception { - UiResourceDataTransfer testSubject; - Map interfaces = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInterfaces(interfaces); - } - - - @Test - public void testGetDefaultCapabilities() throws Exception { - UiResourceDataTransfer testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDefaultCapabilities(); - } - - - @Test - public void testSetDefaultCapabilities() throws Exception { - UiResourceDataTransfer testSubject; - List defaultCapabilities = null; + private UiResourceDataTransfer createTestSubject() { + return new UiResourceDataTransfer(); + } - // default test - testSubject = createTestSubject(); - testSubject.setDefaultCapabilities(defaultCapabilities); - } + @Test + public void testCtor() throws Exception { + final UiResourceDataTransfer testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UiResourceDataTransfer.class); + } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceMetadataTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceMetadataTest.java index 5aef1258c7..d548d76274 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceMetadataTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiResourceMetadataTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,214 +20,21 @@ package org.openecomp.sdc.be.ui.model; -import java.util.List; - +import org.assertj.core.api.Assertions; import org.junit.Test; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; public class UiResourceMetadataTest { - private UiResourceMetadata createTestSubject() { - return new UiResourceMetadata(null, null, new ResourceMetadataDataDefinition()); - } - - - @Test - public void testGetDerivedFrom() throws Exception { - UiResourceMetadata testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDerivedFrom(); - } - - - @Test - public void testSetDerivedFrom() throws Exception { - UiResourceMetadata testSubject; - List derivedFrom = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDerivedFrom(derivedFrom); - } - - - @Test - public void testGetVendorName() throws Exception { - UiResourceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVendorName(); - } - - - @Test - public void testSetVendorName() throws Exception { - UiResourceMetadata testSubject; - String vendorName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVendorName(vendorName); - } - - - @Test - public void testGetVendorRelease() throws Exception { - UiResourceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVendorRelease(); - } - - - @Test - public void testSetVendorRelease() throws Exception { - UiResourceMetadata testSubject; - String vendorRelease = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVendorRelease(vendorRelease); - } - - - @Test - public void testGetResourceVendorModelNumber() throws Exception { - UiResourceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceVendorModelNumber(); - } - - - @Test - public void testSetResourceVendorModelNumber() throws Exception { - UiResourceMetadata testSubject; - String resourceVendorModelNumber = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceVendorModelNumber(resourceVendorModelNumber); - } - - - @Test - public void testGetResourceType() throws Exception { - UiResourceMetadata testSubject; - ResourceTypeEnum result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceType(); - } - - - @Test - public void testSetResourceType() throws Exception { - UiResourceMetadata testSubject; - ResourceTypeEnum resourceType = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceType(resourceType); - } - - - @Test - public void testGetIsAbstract() throws Exception { - UiResourceMetadata testSubject; - Boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getIsAbstract(); - } - - - @Test - public void testSetIsAbstract() throws Exception { - UiResourceMetadata testSubject; - Boolean isAbstract = null; - - // default test - testSubject = createTestSubject(); - testSubject.setIsAbstract(isAbstract); - } - - - @Test - public void testGetCost() throws Exception { - UiResourceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCost(); - } - - - @Test - public void testSetCost() throws Exception { - UiResourceMetadata testSubject; - String cost = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCost(cost); - } - - - @Test - public void testGetLicenseType() throws Exception { - UiResourceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLicenseType(); - } - - - @Test - public void testSetLicenseType() throws Exception { - UiResourceMetadata testSubject; - String licenseType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setLicenseType(licenseType); - } - - - @Test - public void testGetToscaResourceName() throws Exception { - UiResourceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaResourceName(); - } + private UiResourceMetadata createTestSubject() { + return new UiResourceMetadata(null, null, new ResourceMetadataDataDefinition()); + } - - @Test - public void testSetToscaResourceName() throws Exception { - UiResourceMetadata testSubject; - String toscaResourceName = ""; + @Test + public void testCtor() throws Exception { + final UiResourceMetadata testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UiResourceMetadata.class); + } - // default test - testSubject = createTestSubject(); - testSubject.setToscaResourceName(toscaResourceName); - } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransferTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransferTest.java index 8527e9bb03..7fbbc25269 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransferTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransferTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,59 +20,20 @@ package org.openecomp.sdc.be.ui.model; -import java.util.Map; - +import org.assertj.core.api.Assertions; import org.junit.Test; -import org.openecomp.sdc.be.model.ArtifactDefinition; public class UiServiceDataTransferTest { - private UiServiceDataTransfer createTestSubject() { - return new UiServiceDataTransfer(); - } - - - @Test - public void testGetMetadata() throws Exception { - UiServiceDataTransfer testSubject; - UiServiceMetadata result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMetadata(); - } - - - @Test - public void testSetMetadata() throws Exception { - UiServiceDataTransfer testSubject; - UiServiceMetadata metadata = null; - - // default test - testSubject = createTestSubject(); - testSubject.setMetadata(metadata); - } - - - @Test - public void testGetServiceApiArtifacts() throws Exception { - UiServiceDataTransfer testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceApiArtifacts(); - } + private UiServiceDataTransfer createTestSubject() { + return new UiServiceDataTransfer(); + } - - @Test - public void testSetServiceApiArtifacts() throws Exception { - UiServiceDataTransfer testSubject; - Map serviceApiArtifacts = null; + @Test + public void testCtor() throws Exception { + final UiServiceDataTransfer testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UiServiceDataTransfer.class); + } - // default test - testSubject = createTestSubject(); - testSubject.setServiceApiArtifacts(serviceApiArtifacts); - } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceMetadataTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceMetadataTest.java index 284216cfcf..016f36387a 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceMetadataTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiServiceMetadataTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,123 +20,21 @@ package org.openecomp.sdc.be.ui.model; +import java.util.ArrayList; +import org.assertj.core.api.Assertions; import org.junit.Test; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; public class UiServiceMetadataTest { - private UiServiceMetadata createTestSubject() { - return new UiServiceMetadata(null, new ServiceMetadataDataDefinition()); - } + private UiServiceMetadata createTestSubject() { + return new UiServiceMetadata(new ArrayList<>(), new ServiceMetadataDataDefinition()); + } - - @Test - public void testGetDistributionStatus() throws Exception { - UiServiceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDistributionStatus(); - } - - - @Test - public void testSetDistributionStatus() throws Exception { - UiServiceMetadata testSubject; - String distributionStatus = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDistributionStatus(distributionStatus); - } - - - @Test - public void testGetEcompGeneratedNaming() throws Exception { - UiServiceMetadata testSubject; - Boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getEcompGeneratedNaming(); - } - - - @Test - public void testSetEcompGeneratedNaming() throws Exception { - UiServiceMetadata testSubject; - Boolean ecompGeneratedNaming = null; - - // default test - testSubject = createTestSubject(); - testSubject.setEcompGeneratedNaming(ecompGeneratedNaming); - } - - - @Test - public void testGetNamingPolicy() throws Exception { - UiServiceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getNamingPolicy(); - } - - - @Test - public void testSetNamingPolicy() throws Exception { - UiServiceMetadata testSubject; - String namingPolicy = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setNamingPolicy(namingPolicy); - } - - - @Test - public void testGetServiceType() throws Exception { - UiServiceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceType(); - } - - - @Test - public void testSetServiceType() throws Exception { - UiServiceMetadata testSubject; - String serviceType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceType(serviceType); - } - - - @Test - public void testGetServiceRole() throws Exception { - UiServiceMetadata testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceRole(); - } - - - @Test - public void testSetServiceRole() throws Exception { - UiServiceMetadata testSubject; - String serviceRole = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceRole(serviceRole); - } + @Test + public void testCtor() throws Exception { + final UiServiceMetadata testSubject = createTestSubject(); + Assertions.assertThat(testSubject).isNotNull().isInstanceOf(UiServiceMetadata.class); + } } -- cgit 1.2.3-korg