diff options
author | 2018-07-29 16:13:45 +0300 | |
---|---|---|
committer | 2018-07-29 16:20:34 +0300 | |
commit | 5b593496b8f1b8e8be8d7d2dbcc223332e65a49b (patch) | |
tree | 2f9dfc45191e723da69cf74be7829784e9741b94 /catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java | |
parent | 9200382f2ce7b4bb729aa287d0878004b2d2b4f9 (diff) |
re base code
Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5
Issue-ID: SDC-1566
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java index 5797516938..23363bef47 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java @@ -20,15 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; @@ -37,6 +28,13 @@ import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.unittests.utils.FactoryUtils; +import java.util.*; +import java.util.stream.Collectors; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + public class CompositionBusinessLogicTest { CompositionBusinessLogic compBl = new CompositionBusinessLogic(); @@ -48,7 +46,7 @@ public class CompositionBusinessLogicTest { FactoryUtils.addComponentInstanceToVF(createVF, FactoryUtils.createResourceInstance()); } Map<ImmutablePair<Double, Double>, ComponentInstance> componentInstances = compBl.buildSpiralPatternPositioningForComponentInstances(createVF); - assertTrue(componentInstances.size() == instancesNum); + assertEquals(componentInstances.size(), instancesNum); // Verify Spiral Pattern ImmutablePair<Double, Double> key; key = new ImmutablePair<>(0D, 0D); @@ -80,11 +78,11 @@ public class CompositionBusinessLogicTest { ComponentInstance vfc = populateVfWithVfcAndCps(allComponentInstances, createVF); Map<ComponentInstance, List<ComponentInstance>> cpsConnectedToVFC = compBl.getCpsConnectedToVFC(allComponentInstances, createVF); - assertTrue(cpsConnectedToVFC.size() == 1); + assertEquals(1, cpsConnectedToVFC.size()); assertTrue(cpsConnectedToVFC.containsKey(vfc)); Set<ComponentInstance> cps = cpsConnectedToVFC.get(vfc).stream().collect(Collectors.toSet()); - assertTrue(cps.size() == 3); - cps.stream().forEach(e -> assertTrue(e.getOriginType() == OriginTypeEnum.CP)); + assertEquals(3, cps.size()); + cps.stream().forEach(e -> assertSame(e.getOriginType(), OriginTypeEnum.CP)); } @@ -96,16 +94,16 @@ public class CompositionBusinessLogicTest { Map<ComponentInstance, List<ComponentInstance>> cpsConnectedToVFC = compBl.getCpsConnectedToVFC(allComponentInstances, createVF); Map<ImmutablePair<Double, Double>, ComponentInstance> componentInstLocations = new HashMap<>(); - componentInstLocations.put(new ImmutablePair<Double, Double>(0D, 0D), vfcInstance); + componentInstLocations.put(new ImmutablePair<>(0D, 0D), vfcInstance); compBl.buildCirclePatternForCps(componentInstLocations, cpsConnectedToVFC); - assertTrue(componentInstLocations.size() == 4); + assertEquals(4, componentInstLocations.size()); - Set<ImmutablePair<Double, Double>> cpsLocations = componentInstLocations.entrySet().stream().filter(entry -> entry.getValue().getOriginType() == OriginTypeEnum.CP).map(e -> e.getKey()).collect(Collectors.toSet()); + Set<ImmutablePair<Double, Double>> cpsLocations = componentInstLocations.entrySet().stream().filter(entry -> entry.getValue().getOriginType() == OriginTypeEnum.CP).map(Map.Entry::getKey).collect(Collectors.toSet()); // Verify that all cps are located at different positions - assertTrue(cpsLocations.size() == 3); + assertEquals(3, cpsLocations.size()); Set<Double> distances = cpsLocations.stream().map(cpLocation -> Math.sqrt(Math.pow(cpLocation.left, 2) + Math.pow(cpLocation.right, 2))).collect(Collectors.toSet()); // Verify that all cps are at the same distance from center - assertTrue(distances.size() == 1); + assertEquals(1, distances.size()); } |