### Question:
CreateNetworkCollection { public void buildNetworkCollectionName(BuildingBlockExecution execution) throws Exception { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup(); if (instanceGroup.getModelInfoInstanceGroup() != null) { if (serviceInstance.getServiceInstanceName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) { String networkCollectionName = serviceInstance.getServiceInstanceName().concat(UNDERSCORE) .concat(instanceGroup.getModelInfoInstanceGroup().getFunction()); execution.setVariable(NETWORK_COLLECTION_NAME, networkCollectionName); } else { throw new IllegalArgumentException( "Cannot generate collection name because either one or both fields are null: " + " Service Instance Name: " + serviceInstance.getServiceInstanceName() + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction()); } } else { throw new IllegalArgumentException("Instance group model info is null"); } } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } }  void buildNetworkCollectionName(BuildingBlockExecution execution); void connectCollectionToInstanceGroup(BuildingBlockExecution execution); void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution); void connectCollectionToServiceInstance(BuildingBlockExecution execution);  }### Answer:
@Test public void buildCreateNetworkRequestTest() throws Exception { createNetworkCollection.buildNetworkCollectionName(execution); assertEquals( serviceInstance.getServiceInstanceName() + "_" + serviceInstance.getCollection().getInstanceGroup().getModelInfoInstanceGroup().getFunction(), execution.getVariable("networkCollectionName")); }
@Test(expected = BpmnError.class) public void buildCreateNetworkRequestInstanceGroupModelInfoFunctionNullExceptionTest() throws Exception { ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup); createNetworkCollection.buildNetworkCollectionName(execution); }
@Test(expected = BpmnError.class) public void buildCreateNetworkRequestInstanceGroupModelInfoNullTest() throws Exception { serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(null); createNetworkCollection.buildNetworkCollectionName(execution); }