### Question:
BBInputSetup implements JavaDelegate { protected void populateNetworkCollectionAndInstanceGroupAssign(BBInputSetupParameter parameter) throws Exception { if (parameter.getServiceInstance().getCollection() == null && parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) { Collection collection = this.createCollection(parameter.getResourceId()); parameter.getServiceInstance().setCollection(collection); this.mapCatalogCollection(parameter.getService(), parameter.getServiceInstance().getCollection(), parameter.getKey()); if (isVlanTagging(parameter.getService(), parameter.getKey())) { InstanceGroup instanceGroup = this.createInstanceGroup(); parameter.getServiceInstance().getCollection().setInstanceGroup(instanceGroup); this.mapCatalogNetworkCollectionInstanceGroup(parameter.getService(), parameter.getServiceInstance().getCollection().getInstanceGroup(), parameter.getKey()); } } }  BBInputSetupUtils getBbInputSetupUtils(); void setCloudInfoFromAAI(CloudInfoFromAAI cloudInfoFromAAI); void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils); BBInputSetupMapperLayer getMapperLayer(); void setMapperLayer(BBInputSetupMapperLayer mapperLayer); @Override void execute(DelegateExecution execution); ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI);  }### Answer:
@Test public void testPopulateNetworkCollectionAndInstanceGroupAssign() throws Exception { Service service = Mockito.mock(Service.class); String key = "collectionCustId"; ServiceInstance serviceInstance = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), ServiceInstance.class); String resourceId = "123"; Collection collection = SPY_bbInputSetup.createCollection(resourceId); InstanceGroup instanceGroup = SPY_bbInputSetup.createInstanceGroup(); assertNull(serviceInstance.getCollection()); doReturn(true).when(SPY_bbInputSetup).isVlanTagging(service, key); doReturn(collection).when(SPY_bbInputSetup).createCollection(resourceId); doReturn(instanceGroup).when(SPY_bbInputSetup).createInstanceGroup(); doNothing().when(SPY_bbInputSetup).mapCatalogCollection(service, collection, key); NetworkCollectionResourceCustomization networkCollection = new NetworkCollectionResourceCustomization(); networkCollection.setModelCustomizationUUID(key); networkCollection.setCollectionResource(new CollectionResource()); networkCollection.getCollectionResource().setInstanceGroup(new org.onap.so.db.catalog.beans.InstanceGroup()); networkCollection.getCollectionResource().getInstanceGroup().setToscaNodeType("NetworkCollectionResource"); networkCollection.getCollectionResource().getInstanceGroup().setType(InstanceGroupType.L3_NETWORK); networkCollection.getCollectionResource().getInstanceGroup() .setCollectionInstanceGroupCustomizations(new ArrayList<>()); List<CollectionResourceCustomization> customizations = new ArrayList<>(); customizations.add(networkCollection); doReturn(customizations).when(service).getCollectionResourceCustomizations(); BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setService(service) .setServiceInstance(serviceInstance).setResourceId(resourceId).setKey(key) .setBbName(AssignFlows.NETWORK_COLLECTION.toString()).build(); SPY_bbInputSetup.populateNetworkCollectionAndInstanceGroupAssign(parameter); assertNotNull(serviceInstance.getCollection()); assertNotNull(serviceInstance.getCollection().getInstanceGroup()); verify(SPY_bbInputSetup, times(1)).mapCatalogCollection(service, serviceInstance.getCollection(), key); verify(SPY_bbInputSetup, times(1)).mapCatalogNetworkCollectionInstanceGroup(service, serviceInstance.getCollection().getInstanceGroup(), key); }