### Question:
AAICreateTasks { public void createVfModule(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); int moduleIndex = 0; if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) { moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule); } vfModule.setModuleIndex(moduleIndex); aaiVfModuleResources.createVfModule(vfModule, vnf); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } }  void createServiceInstance(BuildingBlockExecution execution); void createServiceSubscription(BuildingBlockExecution execution); void createProject(BuildingBlockExecution execution); void createOwningEntity(BuildingBlockExecution execution); void createVnf(BuildingBlockExecution execution); void createPnf(BuildingBlockExecution execution); void createPlatformForNetwork(BuildingBlockExecution execution); void createPlatform(BuildingBlockExecution execution); List<String> splitCDL(String str); void createLineOfBusiness(BuildingBlockExecution execution); void createLineOfBusinessForNetwork(BuildingBlockExecution execution); void createVolumeGroup(BuildingBlockExecution execution); void createVfModule(BuildingBlockExecution execution); void connectVfModuleToVolumeGroup(BuildingBlockExecution execution); void createNetwork(BuildingBlockExecution execution); void createCustomer(BuildingBlockExecution execution); void createNetworkCollection(BuildingBlockExecution execution); void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution); void connectNetworkToTenant(BuildingBlockExecution execution); void connectNetworkToCloudRegion(BuildingBlockExecution execution); void connectVnfToCloudRegion(BuildingBlockExecution execution); void connectVnfToTenant(BuildingBlockExecution execution); void connectNetworkToNetworkCollectionServiceInstance(BuildingBlockExecution execution); void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution); void createConfiguration(BuildingBlockExecution execution); void createInstanceGroupVnf(BuildingBlockExecution execution); void createNetworkPolicies(BuildingBlockExecution execution);  }### Answer:
@Test public void createVfModuleTest() throws Exception { VfModule newVfModule = setVfModule(false); newVfModule.setModuleIndex(null); newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1"); doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))) .thenReturn(newVfModule); assertEquals(null, newVfModule.getModuleIndex()); execution.setVariable("aLaCarte", Boolean.FALSE); aaiCreateTasks.createVfModule(execution); assertEquals(1, newVfModule.getModuleIndex().intValue()); verify(aaiVfModuleResources, times(1)).createVfModule(newVfModule, genericVnf); }
@Test public void createVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVfModuleResources).createVfModule(vfModule, genericVnf); aaiCreateTasks.createVfModule(execution); }