### Question:
WorkflowAction { protected String validateVolumeGroupResourceIdInAAI(String generatedResourceId, String instanceName, RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { Optional<VolumeGroup> volumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName); if (volumeGroup.isPresent()) { if (volumeGroup.get().getVfModuleModelCustomizationId() .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { return volumeGroup.get().getVolumeGroupId(); } else { throw new DuplicateNameException("volumeGroup", volumeGroup.get().getVolumeGroupName()); } } if (bbInputSetupUtils.existsAAIVolumeGroupGloballyByName(instanceName)) { throw new DuplicateNameException("volumeGroup", instanceName); } return generatedResourceId; }  void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils); void setBbInputSetup(BBInputSetup bbInputSetup); void selectExecutionList(DelegateExecution execution); void handleRuntimeException(DelegateExecution execution);  }### Answer:
@Test public void validateVolumeGroupResourceIdInAAITest() throws Exception { RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); workflowResourceIds.setVnfId("vnfId123"); when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123")).thenReturn(Optional.empty()); when(bbSetupUtils.existsAAIVolumeGroupGloballyByName("name123")).thenReturn(false); String id = workflowAction.validateVolumeGroupResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); assertEquals("generatedId123", id); }