### Question:
WorkflowActionBBTasks { protected void updateInstanceId(DelegateExecution execution) { try { String requestId = (String) execution.getVariable(G_REQUEST_ID); String resourceId = (String) execution.getVariable("resourceId"); WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType"); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); if (resourceType == WorkflowType.SERVICE) { request.setServiceInstanceId(resourceId); } else if (resourceType == WorkflowType.VNF) { request.setVnfId(resourceId); } else if (resourceType == WorkflowType.VFMODULE) { request.setVfModuleId(resourceId); } else if (resourceType == WorkflowType.VOLUMEGROUP) { request.setVolumeGroupId(resourceId); } else if (resourceType == WorkflowType.NETWORK) { request.setNetworkId(resourceId); } else if (resourceType == WorkflowType.CONFIGURATION) { request.setConfigurationId(resourceId); } else if (resourceType == WorkflowType.INSTANCE_GROUP) { request.setInstanceGroupId(resourceId); } setInstanceName(resourceId, resourceType, request); request.setLastModifiedBy("CamundaBPMN"); requestDbclient.updateInfraActiveRequests(request); } catch (Exception ex) { logger.error("Exception in updateInstanceId", ex); workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId"); } }  void selectBB(DelegateExecution execution); void updateFlowStatistics(DelegateExecution execution); void sendSyncAck(DelegateExecution execution); void sendErrorSyncAck(DelegateExecution execution); void updateRequestStatusToComplete(DelegateExecution execution); void checkRetryStatus(DelegateExecution execution); void rollbackExecutionPath(DelegateExecution execution); void postProcessingExecuteBB(DelegateExecution execution);  }### Answer:
@Test public void updateInstanceId() { String reqId = "req123"; String instanceId = "123123123"; execution.setVariable("mso-request-id", reqId); execution.setVariable("resourceId", instanceId); execution.setVariable("resourceType", WorkflowType.SERVICE); doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); workflowActionBBTasks.updateInstanceId(execution); Mockito.verify(reqMock, Mockito.times(1)).setServiceInstanceId(instanceId); }