### Question:
AAICreateTasks { public void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null) aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(l3network, serviceInstance.getCollection().getInstanceGroup()); } 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 connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception { doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup()); aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution); verify(aaiNetworkResources, times(1)).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup()); }
@Test public void connectNetworkToNullNetworkCollectionInstanceGroupTest() throws Exception { ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setServiceInstanceId("testServiceInstanceId"); L3Network network = new L3Network(); network.setNetworkId("testNetworkId"); serviceInstance.getNetworks().add(network); lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); gBBInput.setServiceInstance(serviceInstance); lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))) .thenReturn(serviceInstance); exception.expect(BpmnError.class); aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution); verify(aaiNetworkResources, never()).connectNetworkToNetworkCollectionInstanceGroup(network, null); }