From dfc9cdee69426b48d683e119dda9fae9154e6fde Mon Sep 17 00:00:00 2001 From: vasraz Date: Mon, 1 Mar 2021 20:58:10 +0000 Subject: Improve test coverage - remove unused code - use lombok Change-Id: I8c52584249347c7ca2102022457225401f95b9a5 Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3490 --- .../openecomp/sdc/be/model/CombinationTest.java | 9 +-- .../operations/impl/PropertyOperationTest.java | 85 ---------------------- 2 files changed, 1 insertion(+), 93 deletions(-) (limited to 'catalog-model/src/test') diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CombinationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CombinationTest.java index 2f63c2310e..13c82c6933 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CombinationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CombinationTest.java @@ -24,9 +24,6 @@ import org.junit.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.ui.model.UiCombination; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static org.hamcrest.MatcherAssert.assertThat; - public class CombinationTest { @Test @@ -35,8 +32,4 @@ public class CombinationTest { new Combination(uiComb); } - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(Combination.class, hasValidGettersAndSetters()); - } -} \ No newline at end of file +} diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java index e3d69fdadc..254208e06c 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java @@ -62,27 +62,6 @@ public class PropertyOperationTest extends ModelTestBase { } - /* - * @Test public void addPropertyToResourceTest() { - * - * String propName = "myProp"; PropertyDefinition property = buildPropertyDefinition(); List constraints = buildConstraints(); property.setConstraints(constraints); - * - * PropertyData propertyData = new PropertyData(property, propertyOperation.convertConstraintsToString(constraints)); - * - * Either either = Either.left(propertyData); //when(propertyDao.create((GraphNeighbourTable)anyObject(), eq(PropertyData.class), eq(NodeTypeEnum.Property))).thenReturn(either); GraphRelation graphRelation = - * new GraphRelation(); Either relationResult = Either.left(graphRelation); - * - * when(janusGraphGenericDao.createNode((PropertyData)anyObject(), eq(PropertyData.class))).thenReturn(either); when(janusGraphGenericDao.createRelation((GraphNode)anyObject(), (GraphNode)anyObject(), eq(GraphEdgeLabels.PROPERTY), - * anyMap())).thenReturn(relationResult); - * - * Either result = propertyOperation.addPropertyToResource(propName, property, NodeTypeEnum.Resource, "my-resource.1.0"); - * - * assertTrue(result.isLeft()); System.out.println(result.left().value()); PropertyDefinition propertyDefinition = result.left().value(); - * - * List originalConstraints = property.getConstraints(); List propertyConstraintsResult = propertyDefinition.getConstraints(); assertEquals(propertyConstraintsResult.size(), originalConstraints.size()); - * - * } - */ private PropertyDefinition buildPropertyDefinition() { PropertyDefinition property = new PropertyDefinition(); property.setDefaultValue("10"); @@ -91,60 +70,6 @@ public class PropertyOperationTest extends ModelTestBase { return property; } - @Test - public void addPropertiesToGraphTableTest() { - - // Map properties = new HashMap(); - // String propName = "myProp"; - // PropertyDefinition property = buildPropertyDefinition(); - // - // List constraints = buildConstraints(); - // property.setConstraints(constraints); - // - // properties.put(propName, property); - // - // GraphNeighbourTable graphNeighbourTable = new GraphNeighbourTable(); - // ResourceData resourceData = new ResourceData(); - // String resourceName = "my-resource"; - // String resourceVersion = "1.0"; - // String resourceId = resourceName + "." + resourceVersion; - // resourceData.setUniqueId(resourceId); - // int resourceIndex = graphNeighbourTable.addNode(resourceData); - // - // heatParametersOperation.addPropertiesToGraphTable(properties, - // graphNeighbourTable, resourceIndex, resourceId); - // - // assertEquals(2, graphNeighbourTable.getNodes().size()); - // assertEquals(1, graphNeighbourTable.getDirectedEdges().size()); - // List nodes = graphNeighbourTable.getNodes(); - // boolean nodeFound = false; - // for (GraphNode neo4jNode : nodes) { - // if (neo4jNode instanceof PropertyData) { - // PropertyData propertyData = (PropertyData)neo4jNode; - // assertEquals("check property unique id", resourceId + "." + propName, - // propertyData.getUniqueId()); - // assertEquals(property.getDescription(), - // propertyData.getPropertyDataDefinition().getDescription()); - // nodeFound = true; - // } - // } - // assertEquals("looking for PropertyData object in table", true, - // nodeFound); - // - // NodeRelation nodeRelation = - // graphNeighbourTable.getDirectedEdges().get(0); - // assertEquals("check from index to index edge", 0, - // nodeRelation.getFromIndex()); - // assertEquals("check from index to index edge", 1, - // nodeRelation.getToIndex()); - // assertEquals("check edge type", - // GraphEdgePropertiesDictionary.PROPERTY, - // nodeRelation.getEdge().getEdgeType()); - // assertEquals("check propert name on edge", true, - // nodeRelation.getEdge().getProperties().values().contains(propName)); - } - @Test public void convertConstraintsTest() { @@ -516,16 +441,6 @@ public class PropertyOperationTest extends ModelTestBase { return new PropertyOperation(new HealingJanusGraphGenericDao(new JanusGraphClient()), null); } - - @Test - public void testMain() throws Exception { - String[] args = new String[] { "" }; - - // default test - PropertyOperation.main(args); - } - - @Test public void testConvertPropertyDataToPropertyDefinition() throws Exception { PropertyOperation testSubject; -- cgit 1.2.3-korg