Remove usage of outdated library JMockit (catalog-dao)
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / impl / InterfaceOperationBusinessLogicTest.java
index aa71d76..5ff6f40 100644 (file)
 
 package org.openecomp.sdc.be.components.impl;
 
-import fj.data.Either;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.sdc.ElementOperationMock;
-import org.openecomp.sdc.be.auditing.impl.AuditingManager;
-import org.openecomp.sdc.be.components.InterfaceOperationTestUtils;
-import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
+import org.openecomp.sdc.be.components.utils.ResourceBuilder;
 import org.openecomp.sdc.be.components.validation.InterfaceOperationValidation;
 import org.openecomp.sdc.be.components.validation.UserValidations;
 import org.openecomp.sdc.be.config.ConfigurationManager;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
 import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
+import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 import org.openecomp.sdc.be.impl.ComponentsUtils;
-import org.openecomp.sdc.be.impl.WebAppContextWrapper;
-import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import org.openecomp.sdc.be.model.jsontitan.operations.*;
-import org.openecomp.sdc.be.model.operations.api.IElementOperation;
-import org.openecomp.sdc.be.model.operations.api.IPropertyOperation;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.InputDefinition;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
-import org.openecomp.sdc.be.user.Role;
-import org.openecomp.sdc.be.user.UserBusinessLogic;
-import org.openecomp.sdc.common.api.ConfigurationSource;
-import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
 import org.openecomp.sdc.common.impl.ExternalConfiguration;
 import org.openecomp.sdc.common.impl.FSConfigurationSource;
 import org.openecomp.sdc.exception.ResponseFormat;
-import org.springframework.web.context.WebApplicationContext;
-
-import javax.servlet.ServletContext;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
+import org.openecomp.sdc.test.utils.InterfaceOperationTestUtils;
 
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.when;
+import fj.data.Either;
 
-public class InterfaceOperationBusinessLogicTest implements InterfaceOperationTestUtils{
+@RunWith(MockitoJUnitRunner.class)
+public class InterfaceOperationBusinessLogicTest {
 
-    public static final String RESOURCE_CATEGORY1 = "Network Layer 2-3";
-    public static final String RESOURCE_SUBCATEGORY = "Router";
+    private static final String resourceId = "resourceId";
+    private static final String interfaceId = "interfaceId";
+    private static final String operationId = "operationId";
+    private static final String inputId = "inputId";
+    private static final String RESOURCE_NAME = "Resource1";
+    private static final String operationId1 = "operationId1";
+    private static final String interfaceId1 = "interfaceId1";
+    private static final String operationName = "createOperation";
 
+    @InjectMocks
+    private InterfaceOperationBusinessLogic interfaceOperationBusinessLogic;
+    @Mock
+    private UserValidations userValidations;
+    @Mock
+    private ToscaOperationFacade toscaOperationFacade;
+    @Mock
+    private ComponentsUtils componentsUtils;
+    @Mock
+    private IGraphLockOperation graphLockOperation;
+    @Mock
+    private JanusGraphDao janusGraphDao;
+    @Mock
+    private InterfaceLifecycleOperation interfaceLifecycleOperation;
+    @Mock
+    private InterfaceOperationValidation interfaceOperationValidation;
+    @Mock
+    private InterfaceOperation interfaceOperation;
+    @Mock
+    private ArtifactCassandraDao artifactCassandraDao;
+    @Mock
+    protected ArtifactsOperations artifactToscaOperation;
+    private User user;
+    private Resource resource;
 
-    private String resourceId = "resourceId1";
-    private String operationId = "uniqueId1";
-    Resource resourceUpdate;
+    @Before
+    public void setup() {
+        interfaceOperationBusinessLogic.setUserValidations(userValidations);
+        interfaceOperationBusinessLogic.setToscaOperationFacade(toscaOperationFacade);
+        interfaceOperationBusinessLogic.setGraphLockOperation(graphLockOperation);
+        interfaceOperationBusinessLogic.setJanusGraphDao(janusGraphDao);
+        interfaceOperationBusinessLogic.setComponentsUtils(componentsUtils);
+        resource = new ResourceBuilder().setComponentType(ComponentTypeEnum.RESOURCE).setUniqueId(resourceId)
+                           .setName(RESOURCE_NAME).build();
+        resource.setInterfaces(InterfaceOperationTestUtils.createMockInterfaceDefinitionMap(interfaceId, operationId,
+                operationName));
+        resource.setInputs(createInputsForResource());
 
-    public static final String RESOURCE_NAME = "My-Resource_Name with   space";
+        user = new User();
+        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
+        when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Resource)))
+                .thenReturn(StorageOperationStatus.OK);
+        when(interfaceOperationValidation
+                     .validateInterfaceOperations(any(), any(), any(), anyMap(), anyBoolean()))
+                .thenReturn(Either.left(true));
+        when(interfaceOperationValidation
+                .validateDeleteOperationContainsNoMappedOutput(any(), any(), any()))
+                .thenReturn(Either.left(true));
+        when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
+        new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
+    }
 
-    final ServletContext servletContext = Mockito.mock(ServletContext.class);
-    IElementOperation mockElementDao;
-    TitanDao mockTitanDao = Mockito.mock(TitanDao.class);
-    UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class);
-    ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
-    NodeTypeOperation nodeTypeOperation = Mockito.mock(NodeTypeOperation.class);
-    NodeTemplateOperation nodeTemplateOperation = Mockito.mock(NodeTemplateOperation.class);
-    TopologyTemplateOperation topologyTemplateOperation = Mockito.mock(TopologyTemplateOperation.class);
-    final IPropertyOperation propertyOperation = Mockito.mock(IPropertyOperation.class);
-    final ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class);
-    WebAppContextWrapper webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class);
-    UserValidations userValidations = Mockito.mock(UserValidations.class);
-    WebApplicationContext webAppContext = Mockito.mock(WebApplicationContext.class);
-    ArtifactCassandraDao artifactCassandraDao = Mockito.mock(ArtifactCassandraDao.class);
-    InterfaceOperation interfaceOperation = Mockito.mock(InterfaceOperation.class);
-    InterfaceOperationValidation operationValidator = Mockito.mock(InterfaceOperationValidation.class);
+    private List<InputDefinition> createInputsForResource() {
+        InputDefinition inputDefinition = new InputDefinition();
+        inputDefinition.setName(inputId);
+        inputDefinition.setInputId(inputId);
+        inputDefinition.setUniqueId(inputId);
+        inputDefinition.setValue(inputId);
+        inputDefinition.setDefaultValue(inputId);
+        return Arrays.asList(inputDefinition);
+    }
 
-    ResponseFormatManager responseManager = null;
-    GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class);
-    User user = null;
-    Resource resourceResponse = null;
-    ComponentsUtils componentsUtils;
-    ArtifactsBusinessLogic artifactManager = new ArtifactsBusinessLogic();
-    private GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class);
+    @Test
+    public void createInterfaceOperationTestOnExistingInterface() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName))));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperationEither =
+                interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                    Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                            operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperationEither.isLeft());
+    }
 
+    @Test
+    public void createInterfaceOperationTestOnExistingInterfaceInputsFromCapProp() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName))));
+
+        CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+        capabilityDefinition.setName("cap" + Math.random());
+        capabilityDefinition.setType("tosca.capabilities.network.Bindable");
+        capabilityDefinition.setOwnerId(resourceId);
+        capabilityDefinition.setUniqueId("capUniqueId");
+
+        List<ComponentInstanceProperty> properties = new ArrayList<>();
+        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
+        instanceProperty.setUniqueId("ComponentInput1_uniqueId");
+        instanceProperty.setType("Integer");
+        instanceProperty.setName("prop_name");
+        instanceProperty.setDescription("prop_description_prop_desc");
+        instanceProperty.setOwnerId("capUniqueId");
+        instanceProperty.setSchema(new SchemaDefinition());
+        properties.add(instanceProperty);
+        capabilityDefinition.setProperties(properties);
+        Map<String, List<CapabilityDefinition>> capabilityMap = new HashMap<>();
+        capabilityMap.put(capabilityDefinition.getType(), Collections.singletonList(capabilityDefinition));
+
+        resource.setCapabilities(capabilityMap);
+        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
 
-    @InjectMocks
-    InterfaceOperationBusinessLogic bl = new InterfaceOperationBusinessLogic();
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperationEither =
+                interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperationEither.isLeft());
+    }
 
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        Mockito.reset(propertyOperation);
 
-        ExternalConfiguration.setAppName("catalog-be");
+    @Test
+    public void createInterfaceOperationWithoutInterfaceTest() {
+        resource.getInterfaces().clear();
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(interfaceOperation.addInterfaces(any(), any())).thenReturn(Either.left(
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName))));
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName))));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperationEither =
+                interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperationEither.isLeft());
+    }
 
-        // init Configuration
-        String appConfigDir = "src/test/resources/config/catalog-be";
-        ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
-        ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
-        componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class));
+    @Test
+    public void createInterfaceOperationWithoutInterfaceTestFail() {
+        resource.getInterfaces().clear();
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(interfaceOperation.addInterfaces(any(), any()))
+                .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperationEither =
+                interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperationEither.isRight());
+    }
 
-        // Elements
-        mockElementDao = new ElementOperationMock();
+    @Test
+    public void shouldFailWhenCreateInterfaceOperationFailedTest() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(interfaceOperation.updateInterfaces(any(), any()))
+                .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
+        Assert.assertTrue(interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName)),
+                user, true).isRight());
+    }
 
-        // User data and management
-        user = new User();
-        user.setUserId("jh0003");
-        user.setFirstName("Jimmi");
-        user.setLastName("Hendrix");
-        user.setRole(Role.ADMIN.name());
-
-        Either<User, ActionStatus> eitherGetUser = Either.left(user);
-        when(mockUserAdmin.getUser("jh0003", false)).thenReturn(eitherGetUser);
-        when(userValidations.validateUserExists(eq(user.getUserId()), anyString(), eq(false))).thenReturn(user);
-        when(userValidations.validateUserNotEmpty(eq(user), anyString())).thenReturn(user);
-        // Servlet Context attributes
-        when(servletContext.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).thenReturn(configurationManager);
-        when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(webAppContextWrapper);
-        when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webAppContext);
-        when(webAppContext.getBean(IElementOperation.class)).thenReturn(mockElementDao);
-
-        Either<Boolean, StorageOperationStatus> eitherFalse = Either.left(true);
-        when(toscaOperationFacade.validateComponentNameExists("Root", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherFalse);
-
-        Either<Boolean, StorageOperationStatus> eitherCountExist = Either.left(true);
-        when(toscaOperationFacade.validateComponentNameExists("alreadyExists", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCountExist);
-
-        Either<Boolean, StorageOperationStatus> eitherCount = Either.left(false);
-        when(toscaOperationFacade.validateComponentNameExists(eq(RESOURCE_NAME), any(ResourceTypeEnum.class), eq(ComponentTypeEnum.RESOURCE))).thenReturn(eitherCount);
-
-        Either<Boolean, StorageOperationStatus> validateDerivedExists = Either.left(true);
-        when(toscaOperationFacade.validateToscaResourceNameExists("Root")).thenReturn(validateDerivedExists);
-
-        Either<Boolean, StorageOperationStatus> validateDerivedNotExists = Either.left(false);
-        when(toscaOperationFacade.validateToscaResourceNameExists("kuku")).thenReturn(validateDerivedNotExists);
-        when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Resource))).thenReturn(StorageOperationStatus.OK);
-        when(graphLockOperation.lockComponentByName(Mockito.anyString(), eq(NodeTypeEnum.Resource))).thenReturn(StorageOperationStatus.OK);
-
-        // createResource
-        resourceResponse = createResourceObject(true);
-        Either<Resource, StorageOperationStatus> eitherCreate = Either.left(resourceResponse);
-        Either<Integer, StorageOperationStatus> eitherValidate = Either.left(null);
-        when(toscaOperationFacade.createToscaComponent(any(Resource.class))).thenReturn(eitherCreate);
-        //TODO Remove if passes
-        /*when(toscaOperationFacade.validateCsarUuidUniqueness(Mockito.anyString())).thenReturn(eitherValidate);*/
-        Map<String, DataTypeDefinition> emptyDataTypes = new HashMap<String, DataTypeDefinition>();
-        when(applicationDataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes));
-
-        //InterfaceOperation
-
-        when(operationValidator.validateInterfaceOperations(anyCollection(), anyString(), anyBoolean())).thenReturn(Either.left(true));
-        when(interfaceOperation.addInterface(anyString(), anyObject())).thenReturn(Either.left(mockInterfaceDefinitionToReturn(RESOURCE_NAME)));
-        when(interfaceOperation.updateInterface(anyString(), anyObject())).thenReturn(Either.left(mockInterfaceDefinitionToReturn(RESOURCE_NAME)));
-        when(interfaceOperation.deleteInterface(anyObject(), anyObject())).thenReturn(Either.left(new HashSet<>()));
-        when(interfaceOperation.deleteInterface(any(),any())).thenReturn(Either.left(new HashSet<>()));
-        when(interfaceOperation.updateInterface(any(),any())).thenReturn(Either.left(mockInterfaceDefinitionToReturn(RESOURCE_NAME)));
-        when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK);
-
-        // BL object
-        artifactManager.setNodeTemplateOperation(nodeTemplateOperation);
-        bl = new InterfaceOperationBusinessLogic();
-
-        bl.setUserAdmin(mockUserAdmin);
-        bl.setComponentsUtils(componentsUtils);
-        bl.setGraphLockOperation(graphLockOperation);
-        bl.setTitanGenericDao(mockTitanDao);
-        bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic);
-        toscaOperationFacade.setNodeTypeOperation(nodeTypeOperation);
-        toscaOperationFacade.setTopologyTemplateOperation(topologyTemplateOperation);
-        bl.setToscaOperationFacade(toscaOperationFacade);
-        bl.setUserValidations(userValidations);
-        bl.setInterfaceOperation(interfaceOperation);
-        bl.setInterfaceOperationValidation(operationValidator);
-        bl.setArtifactCassandraDao(artifactCassandraDao);
-        Resource resourceCsar = createResourceObjectCsar(true);
-        setCanWorkOnResource(resourceCsar);
-        Either<Component, StorageOperationStatus> oldResourceRes = Either.left(resourceCsar);
-        when(toscaOperationFacade.getToscaFullElement(resourceCsar.getUniqueId())).thenReturn(oldResourceRes);
-        responseManager = ResponseFormatManager.getInstance();
+    @Test
+    public void updateInterfaceOperationTestWithArtifactSuccess() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactCassandraDao.deleteArtifact(any(String.class))).thenReturn(CassandraOperationStatus.OK);
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName))));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperation =
+                interfaceOperationBusinessLogic.updateInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperation.isLeft());
+    }
 
+    @Test
+    public void updateInterfaceOperationTestWithArtifactFailure() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperation =
+                interfaceOperationBusinessLogic.updateInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperation.isRight());
     }
 
     @Test
-    public void createInterfaceOperationTest() {
-        Resource resource = createResourceForInterfaceOperation();
-        resource.setComponentType(ComponentTypeEnum.RESOURCE);
-        validateUserRoles(Role.ADMIN, Role.DESIGNER);
-        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
-        resourceUpdate = setUpResourceMock();
-        Either<Resource, ResponseFormat> interfaceOperation = bl.createInterfaceOperation(resourceId, resourceUpdate, user, true);
+    public void updateInterfaceOperationTestWithoutArtifact() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName))));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperation =
+                interfaceOperationBusinessLogic.updateInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
         Assert.assertTrue(interfaceOperation.isLeft());
     }
 
+    @Test
+    public void updateInterfaceOperationTestDoesntExist() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperation =
+                interfaceOperationBusinessLogic.updateInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperation.isRight());
+    }
 
     @Test
-    public void updateInterfaceOperationTest() {
-        validateUserRoles(Role.ADMIN, Role.DESIGNER);
-        resourceUpdate = setUpResourceMock();
-        Resource resource = createResourceForInterfaceOperation();
-        resource.setComponentType(ComponentTypeEnum.RESOURCE);
-        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
-        Either<Resource, ResponseFormat> interfaceOperation = bl.updateInterfaceOperation(resourceId, resourceUpdate, user, true);
-        Assert.assertTrue(interfaceOperation.isLeft());
+    public void createInterfaceOperationTestFailOnException() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(interfaceOperation.updateInterfaces(any(), any())).thenThrow(new RuntimeException());
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperationEither =
+                interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperationEither.isRight());
     }
 
+    @Test
+    public void createInterfaceOperationTestFailOnFetchinGlobalTypes() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperationEither =
+                interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperationEither.isRight());
+    }
 
     @Test
-    public void deleteInterfaceOperationTest() {
-        Resource resource = createResourceForInterfaceOperation();
-        resource.setComponentType(ComponentTypeEnum.RESOURCE);
-        validateUserRoles(Role.ADMIN, Role.DESIGNER);
-        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
+    public void createInterfaceOperationTestFailOnValidation() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(Collections.emptyMap()));
+        when(interfaceOperationValidation
+                     .validateInterfaceOperations(any(), any(), any(), anyMap(), anyBoolean()))
+                .thenReturn(Either.right(new ResponseFormat()));
+        Either<List<InterfaceDefinition>, ResponseFormat> interfaceOperationEither =
+                interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                        Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId,
+                                operationId, operationName)),
+                        user, true);
+        Assert.assertTrue(interfaceOperationEither.isRight());
+    }
+
+    @Test
+    public void deleteInterfaceOperationTestInterfaceDoesntExist() {
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId1,
+                Collections.singletonList(operationId), user, true).isRight());
+    }
+
+    @Test
+    public void deleteInterfaceOperationTestOperationDoesntExist() {
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId1), user, true).isRight());
+    }
+
+    @Test
+    public void deleteInterfaceOperationTestSuccess() {
+        resource.getInterfaces().get(interfaceId).getOperations()
+                .putAll(InterfaceOperationTestUtils.createMockOperationMap(operationId1, operationName));
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.left(new ArtifactDefinition()));
         when(artifactCassandraDao.deleteArtifact(any(String.class))).thenReturn(CassandraOperationStatus.OK);
-        Set<String> idsToDelete = new HashSet<>();
-        idsToDelete.add(operationId);
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(Collections.emptyList()));
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isLeft());
+    }
 
-        Either<Resource, ResponseFormat> deleteResourceResponseFormatEither = bl.deleteInterfaceOperation(resourceId, idsToDelete, user, true);
-        Assert.assertTrue(deleteResourceResponseFormatEither.isLeft());
+    @Test
+    public void shouldFailWhenDeleteInterfaceOperationFailedTest() {
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactCassandraDao.deleteArtifact(any(String.class))).thenReturn(CassandraOperationStatus.OK);
+        when(interfaceOperation.updateInterfaces(any(), any()))
+                .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR));
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isRight());
     }
 
     @Test
-    public void deleteInterfaceOperationTestShouldFailWrongId() {
-        validateUserRoles(Role.ADMIN, Role.DESIGNER);
-        Set<String> idsToDelete = new HashSet<>();
-        Resource resource = createResourceForInterfaceOperation();
-        resource.setComponentType(ComponentTypeEnum.RESOURCE);
-        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
-        idsToDelete.add(resourceId);
-        Either<Resource, ResponseFormat> deleteResourceResponseFormatEither = bl.deleteInterfaceOperation(resourceId, idsToDelete, user, true);
-        Assert.assertFalse(deleteResourceResponseFormatEither.isLeft());
+    public void shouldFailOnDeleteInterfaceWhenLockComponentFailedTest() {
+        when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Resource)))
+                .thenReturn(StorageOperationStatus.NOT_FOUND);
+        when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.NOT_FOUND, ComponentTypeEnum.RESOURCE)).thenReturn(ActionStatus.RESOURCE_NOT_FOUND);
+        try{
+            interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                    Collections.singletonList(operationId), user, true);
+        } catch (ByActionStatusComponentException e){
+            Assert.assertEquals(ActionStatus.RESOURCE_NOT_FOUND, e.getActionStatus());
+            return;
+        }
+        fail();
     }
 
+    @Test
+    public void shouldFailOnGetInterfaceWhenLockComponentFailedTest() {
+        when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Resource)))
+                .thenReturn(StorageOperationStatus.NOT_FOUND);
+        when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.NOT_FOUND, ComponentTypeEnum.RESOURCE)).thenReturn(ActionStatus.RESOURCE_NOT_FOUND);
+        try{
+            interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId,
+                    Collections.singletonList(operationId), user, true);
+        } catch (ByActionStatusComponentException e){
+            Assert.assertEquals(ActionStatus.RESOURCE_NOT_FOUND, e.getActionStatus());
+            return;
+        }
+        fail();
+    }
 
     @Test
-    public void deleteInterfaceOperationFailToDeleteArtifactTest() {
-        Resource resource = createResourceForInterfaceOperation();
-        resource.setComponentType(ComponentTypeEnum.RESOURCE);
-        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource));
+    public void shouldFailOnCreateInterfaceWhenLockComponentFailedTest() {
+        when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Resource)))
+                .thenReturn(StorageOperationStatus.NOT_FOUND);
+        when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.NOT_FOUND, ComponentTypeEnum.RESOURCE)).thenReturn(ActionStatus.RESOURCE_NOT_FOUND);
+        try{
+            interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                    Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId, operationName)),
+                    user, true);
+        } catch (ByActionStatusComponentException e){
+            Assert.assertEquals(ActionStatus.RESOURCE_NOT_FOUND, e.getActionStatus());
+            return;
+        }
+        fail();
+
+    }
+
+
+    @Test
+    public void deleteInterfaceOperationTestFailOnArtifactDeletion() {
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.left(new ArtifactDefinition()));
         when(artifactCassandraDao.deleteArtifact(any(String.class))).thenReturn(CassandraOperationStatus.GENERAL_ERROR);
-        validateUserRoles(Role.ADMIN, Role.DESIGNER);
-        Set<String> idsToDelete = new HashSet<>();
-        idsToDelete.add(operationId);
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isRight());
+    }
 
-        Either<Resource, ResponseFormat> deleteResourceResponseFormatEither = bl.deleteInterfaceOperation(resourceId, idsToDelete, user, true);
-        Assert.assertTrue(deleteResourceResponseFormatEither.isRight());
+    @Test
+    public void deleteInterfaceOperationTestFailOnException() {
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactCassandraDao.deleteArtifact(any(String.class))).thenThrow(new RuntimeException());
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isRight());
     }
 
     @Test
-    public void interfaceOperationFailedScenarioTest() {
-        validateUserRoles(Role.ADMIN, Role.DESIGNER);
-        Resource resourceWithoutInterface = new Resource();
-        resourceWithoutInterface.setUniqueId(resourceId);
-        when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resourceWithoutInterface));
-        Either<Resource, ResponseFormat> interfaceOperation = bl.updateInterfaceOperation(resourceId, resourceWithoutInterface, user, true);
-        Assert.assertTrue(interfaceOperation.isRight());
+    public void deleteInterfaceTestSuccess() {
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactCassandraDao.deleteArtifact(any(String.class))).thenReturn(CassandraOperationStatus.OK);
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(Collections.emptyList()));
+        when(interfaceOperation.deleteInterface(any(), any())).thenReturn(Either.left(interfaceId));
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isLeft());
     }
 
-    private void validateUserRoles(Role... roles) {
-        List<Role> listOfRoles = Stream.of(roles).collect(Collectors.toList());
-     }
-    private Resource createMockResourceForAddInterface () {
-        Resource resource = new Resource();
-        resource.setUniqueId(resourceId);
-        resource.setName(RESOURCE_NAME);
-        resource.addCategory(RESOURCE_CATEGORY1, RESOURCE_SUBCATEGORY);
-        resource.setDescription("My short description");
+    @Test
+    public void deleteInterfaceTestFailure() {
+        when(artifactToscaOperation.getArtifactById(any(), any())).thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactToscaOperation.removeArifactFromResource(any(), any(), any(), anyBoolean()))
+                .thenReturn(Either.left(new ArtifactDefinition()));
+        when(artifactCassandraDao.deleteArtifact(any(String.class))).thenReturn(CassandraOperationStatus.OK);
+        when(interfaceOperation.updateInterfaces(any(), any())).thenReturn(Either.left(Collections.emptyList()));
+        when(interfaceOperation.deleteInterface(any(), any()))
+                .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR));
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isRight());
+    }
 
-        Map<String, Operation> operationMap = new HashMap<>();
-        Map<String, InterfaceDefinition> interfaceDefinitionMap = new HashMap<>();
-        interfaceDefinitionMap.put("int1", createInterface("int1", "Interface 1",
-                "lifecycle", "org.openecomp.interfaces.node.lifecycle." + RESOURCE_NAME, operationMap));
-        resource.setInterfaces(interfaceDefinitionMap);
-        List<InputDefinition> inputDefinitionList = new ArrayList<>();
-        inputDefinitionList.add(createInputDefinition("uniqueId1"));
-        resource.setInputs(inputDefinitionList);
+    @Test
+    public void getInterfaceOperationTestInterfaceDoesntExist() {
+        Assert.assertTrue(interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId1,
+                Collections.singletonList(operationId), user, true).isRight());
+    }
 
-        return  resource;
+    @Test
+    public void getInterfaceOperationTestOperationDoesntExist() {
+        Assert.assertTrue(interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId1), user, true).isRight());
     }
 
-    private Resource setCanWorkOnResource(Resource resource) {
-        resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
-        resource.setLastUpdaterUserId(user.getUserId());
-        return resource;
+    @Test
+    public void getInterfaceOperationTest() {
+        Assert.assertTrue(interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isLeft());
     }
 
-    private Resource setUpResourceMock(){
-        Resource resource = new Resource();
-        resource.setUniqueId(resourceId);
-        resource.setName(RESOURCE_NAME);
-        resource.addCategory(RESOURCE_CATEGORY1, RESOURCE_SUBCATEGORY);
-        resource.setDescription("My short description");
-        resource.setInterfaces(createMockInterfaceDefinition(RESOURCE_NAME));
+    @Test
+    public void getInterfaceOperationTestFailOnException() {
+        when(janusGraphDao.commit()).thenThrow(new RuntimeException());
+        Assert.assertTrue(interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isRight());
+    }
 
-        List<InputDefinition> inputDefinitionList = new ArrayList<>();
-        inputDefinitionList.add(createInputDefinition("uniqueId1"));
-        resource.setInputs(inputDefinitionList);
+    @Test
+    public void shouldFailWhenGetComponentFailedTest() {
+        when(toscaOperationFacade.getToscaElement(resourceId))
+                .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
+        Assert.assertTrue(interfaceOperationBusinessLogic.deleteInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isRight());
+        Assert.assertTrue(interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId,
+                Collections.singletonList(operationId), user, true).isRight());
+        Assert.assertTrue(interfaceOperationBusinessLogic.createInterfaceOperation(resourceId,
+                Collections.singletonList(InterfaceOperationTestUtils.createMockInterface(interfaceId, operationId,
+                        operationName)), user, true).isRight());
+    }
 
-        return  resource;
+    @Test
+    public void testGetAllInterfaceLifecycleTypes_TypesNotFound() {
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
+        Either<Map<String, InterfaceDefinition>, ResponseFormat> response =
+                interfaceOperationBusinessLogic.getAllInterfaceLifecycleTypes(any());
+        Assert.assertTrue(response.isRight());
     }
 
-    private InputDefinition createInputDefinition(String inputId) {
-        InputDefinition inputDefinition = new InputDefinition();
-        inputDefinition.setInputId(inputId);
-        inputDefinition.setDescription("Input Description");
-
-        return  inputDefinition;
-
-    }
-    private Resource createResourceForInterfaceOperation() {
-        Resource resource = new Resource();
-        resource.setUniqueId(resourceId);
-        resource.setName(RESOURCE_NAME);
-        resource.addCategory(RESOURCE_CATEGORY1, RESOURCE_SUBCATEGORY);
-        resource.setDescription("Resource name for response");
-        resource.setInterfaces(createMockInterfaceDefinition(RESOURCE_NAME));
-        return resource;
-    }
-
-    private Resource createResourceObjectCsar(boolean afterCreate) {
-        Resource resource = new Resource();
-        resource.setName(RESOURCE_NAME);
-        resource.addCategory(RESOURCE_CATEGORY1, RESOURCE_SUBCATEGORY);
-        resource.setDescription("My short description");
-        List<String> tgs = new ArrayList<String>();
-        tgs.add("test");
-        tgs.add(resource.getName());
-        resource.setTags(tgs);
-        List<String> template = new ArrayList<String>();
-        template.add("Root");
-        resource.setDerivedFrom(template);
-        resource.setVendorName("Motorola");
-        resource.setVendorRelease("1.0.0");
-        resource.setResourceVendorModelNumber("");
-        resource.setContactId("ya5467");
-        resource.setIcon("MyIcon");
-        resource.setCsarUUID("valid_vf.csar");
-        resource.setCsarVersion("1");
-
-        if (afterCreate) {
-            resource.setName(resource.getName());
-            resource.setVersion("0.1");
-
-            resource.setUniqueId(resource.getName().toLowerCase() + ":" + resource.getVersion());
-            resource.setCreatorUserId(user.getUserId());
-            resource.setCreatorFullName(user.getFirstName() + " " + user.getLastName());
-            resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
-        }
-        return resource;
-    }
-
-    private Resource createResourceObject(boolean afterCreate) {
-        Resource resource = new Resource();
-        resource.setName(RESOURCE_NAME);
-        resource.addCategory(RESOURCE_CATEGORY1, RESOURCE_SUBCATEGORY);
-        resource.setDescription("My short description");
-        List<String> tgs = new ArrayList<String>();
-        tgs.add("test");
-        tgs.add(resource.getName());
-        resource.setTags(tgs);
-        List<String> template = new ArrayList<String>();
-        template.add("Root");
-        resource.setDerivedFrom(template);
-        resource.setVendorName("Motorola");
-        resource.setVendorRelease("1.0.0");
-        resource.setContactId("ya5467");
-        resource.setIcon("MyIcon");
-
-        if (afterCreate) {
-            resource.setName(resource.getName());
-            resource.setVersion("0.1");
-            resource.setUniqueId(resource.getName().toLowerCase() + ":" + resource.getVersion());
-            resource.setCreatorUserId(user.getUserId());
-            resource.setCreatorFullName(user.getFirstName() + " " + user.getLastName());
-            resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
-        }
-        return resource;
+    @Test
+    public void testGetAllInterfaceLifecycleTypes_Success() {
+        InterfaceDefinition interfaceDefinition = new InterfaceDefinition();
+        interfaceDefinition.setUniqueId(interfaceId);
+        interfaceDefinition.setType(interfaceId);
+        Map<String, InterfaceDefinition> interfaceDefinitionMap = new HashMap<>();
+        interfaceDefinitionMap.put(interfaceDefinition.getUniqueId(), interfaceDefinition);
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
+                .thenReturn(Either.left(interfaceDefinitionMap));
+        Either<Map<String, InterfaceDefinition>, ResponseFormat> response =
+                interfaceOperationBusinessLogic.getAllInterfaceLifecycleTypes(StringUtils.EMPTY);
+        Assert.assertEquals(1, response.left().value().size());
     }