diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-03-01 20:58:10 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-03-01 21:00:16 +0000 |
commit | dfc9cdee69426b48d683e119dda9fae9154e6fde (patch) | |
tree | 70e81d301bcc21b1d604b9f301176c9677dcb33d /catalog-model/src/test/java | |
parent | 97d15f764138e0d49963f168d339fc1637cc5376 (diff) |
Improve test coverage
- remove unused code
- use lombok
Change-Id: I8c52584249347c7ca2102022457225401f95b9a5
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3490
Diffstat (limited to 'catalog-model/src/test/java')
-rw-r--r-- | catalog-model/src/test/java/org/openecomp/sdc/be/model/CombinationTest.java | 9 | ||||
-rw-r--r-- | catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java | 85 |
2 files changed, 1 insertions, 93 deletions
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<PropertyConstraint> constraints = buildConstraints(); property.setConstraints(constraints); - * - * PropertyData propertyData = new PropertyData(property, propertyOperation.convertConstraintsToString(constraints)); - * - * Either<PropertyData, JanusGraphOperationStatus> either = Either.left(propertyData); //when(propertyDao.create((GraphNeighbourTable)anyObject(), eq(PropertyData.class), eq(NodeTypeEnum.Property))).thenReturn(either); GraphRelation graphRelation = - * new GraphRelation(); Either<GraphRelation, JanusGraphOperationStatus> 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<PropertyDefinition, StorageOperationStatus> 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<PropertyConstraint> originalConstraints = property.getConstraints(); List<PropertyConstraint> propertyConstraintsResult = propertyDefinition.getConstraints(); assertEquals(propertyConstraintsResult.size(), originalConstraints.size()); - * - * } - */ private PropertyDefinition buildPropertyDefinition() { PropertyDefinition property = new PropertyDefinition(); property.setDefaultValue("10"); @@ -92,60 +71,6 @@ public class PropertyOperationTest extends ModelTestBase { } @Test - public void addPropertiesToGraphTableTest() { - - // Map<String, PropertyDefinition> properties = new HashMap<String, - // PropertyDefinition>(); - // String propName = "myProp"; - // PropertyDefinition property = buildPropertyDefinition(); - // - // List<PropertyConstraint> 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<GraphNode> 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() { List<PropertyConstraint> constraints = buildConstraints(); @@ -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; |