summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Puzikov <d.puzikov2@partner.samsung.com>2020-03-19 09:18:59 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-03-19 14:30:13 +0000
commit428dc0cd0ee1f847ea6f49b5a760926566d5c184 (patch)
tree37993de572350acbf84d869b20f9f0dbeea53073
parent1762cf55e3fadd4daa986c67980813dc8afd8096 (diff)
Fix unit tests
Add asserts where required, fix tiny issues. Change-Id: Ie88a39642fd574745d9fa1f0eeee301ff8e19e23 Issue-ID: SDC-2838 Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com>
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java5
3 files changed, 11 insertions, 6 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
index 07b2ca6135..06b06b08ad 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
@@ -79,7 +79,7 @@ public class ComponentInstanceArtifactsMergeTest {
.getComponentInstanceDeploymentArtifactsTimeOut();
assertThat(originalComponentDeploymentArtifactsCreatedOnTheInstance.size()).isEqualTo(1);
assertThat(componentInstanceDeploymentArtifactsTimeOut.size()).isEqualTo(3);
- assert (originalComponentDeploymentArtifactsCreatedOnTheInstance.containsKey("artifactTwo"));
+ assertThat(originalComponentDeploymentArtifactsCreatedOnTheInstance.containsKey("artifactTwo")).isTrue();
}
@Test
@@ -141,8 +141,8 @@ public class ComponentInstanceArtifactsMergeTest {
when(artifactsBusinessLogicMock.updateResourceInstanceArtifactNoContent(Mockito.anyString(), Mockito.any(Component.class), Mockito.any(User.class),
Mockito.any(Map.class), Mockito.any(ArtifactOperationInfo.class), Mockito.any(ArtifactDefinition.class))).thenReturn(left);
- testInstance.mergeDataAfterCreate(user, dataForMergeHolder, originComponent, "mock");
-
+ Component result = testInstance.mergeDataAfterCreate(user, dataForMergeHolder, originComponent, "mock");
+ assertThat(result.getDeploymentArtifacts()).isEqualTo(originComponent.getDeploymentArtifacts());
}
private Map<String, ArtifactDefinition> buildDeploymentArtifacts() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java
index d3bc590b42..3e64e52bad 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java
@@ -42,7 +42,7 @@ import java.util.List;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
@@ -78,7 +78,7 @@ public class ComponentInstanceCapabilitiesPropertiesMergeTest {
when(capabilitiesPropertiesMergeBL.mergeComponentInstanceCapabilities(currentComponent, origInstanceNode, "instId", origInstanceCapabilities))
.thenReturn(ActionStatus.OK);
Component mergeResult = testInstance.mergeDataAfterCreate(new User(), mergeHolder, currentComponent, "instId");
- assertTrue(mergeResult != null);
+ assertThat(mergeResult).isNotNull();
}
@Test(expected = ComponentException.class)
@@ -96,5 +96,7 @@ public class ComponentInstanceCapabilitiesPropertiesMergeTest {
ComponentInstance currentResourceInstance = new ComponentInstance();
Component originComponent = new Resource();
testInstance.saveDataBeforeMerge(dataHolder, containerComponent, currentResourceInstance, originComponent);
+ assertThat(dataHolder.getOrigInstanceCapabilities().size()).isEqualTo(originComponent.getCapabilities().size());
+ assertThat(dataHolder.getOrigInstanceNode()).isEqualTo(originComponent);
}
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java
index f5317bba6e..5f70d9d01f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java
@@ -34,6 +34,7 @@ import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder;
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
@@ -45,6 +46,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.when;
@@ -80,7 +82,8 @@ public class ComponentInstanceHeatEnvMergeTest {
when(heatEnvArtifactsMergeBusinessLogicMock.mergeInstanceHeatEnvArtifacts(dataHolder.getOrigComponentInstanceHeatEnvArtifacts(), resource.safeGetComponentInstanceHeatArtifacts(instanceId)))
.thenReturn(mergedArtifacts);
expectMergedArtifactsToBePersisted(mergedArtifacts, instanceId, resource);
- testInstance.mergeDataAfterCreate(USER, dataHolder, resource, instanceId);
+ Component result = testInstance.mergeDataAfterCreate(USER, dataHolder, resource, instanceId);
+ assertThat(result.getDeploymentArtifacts()).isEqualTo(resource.getDeploymentArtifacts());
}
private void expectMergedArtifactsToBePersisted(List<ArtifactDefinition> mergedArtifacts, String instanceId, Resource resource) {