diff options
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java index c87bb2481d..36eee96848 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java @@ -39,6 +39,7 @@ import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.BaseType; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.Resource; @@ -304,4 +305,23 @@ public class ElementBusinessLogicTest extends BaseBusinessLogicMock { Assert.assertTrue(response.isRight()); Assert.assertEquals((Integer) 9, response.right().value().getStatus()); } + + @Test + public void testGetBaseTypes_givenValidUserAndComponentType_thenReturnsSuccessful() { + + List<BaseType> baseTypes = new ArrayList<>(); + baseTypes.add(new BaseType("org.openecomp.type")); + String categoryName = "CAT01"; + + when(userValidations.validateUserExistsActionStatus(eq(user.getUserId()))).thenReturn(ActionStatus.OK); + when(elementDao.getBaseTypes(categoryName)).thenReturn(baseTypes); + Assert.assertTrue(elementBusinessLogic.getBaseTypes(categoryName, user.getUserId()) + .isLeft()); + } + + @Test + public void testGetBaseTypes_givenUserValidationFails_thenReturnsException() { + when(userValidations.validateUserExistsActionStatus(eq(user.getUserId()))).thenReturn(ActionStatus.RESTRICTED_OPERATION); + Assert.assertTrue(elementBusinessLogic.getBaseTypes("CAT01", user.getUserId()).isRight()); + } }
\ No newline at end of file |