### Question:
BBInputSetup implements JavaDelegate { protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) { if (cloudConfiguration == null) { for (Vnfs vnfs : resources.getVnfs()) { if (cloudConfiguration == null) { cloudConfiguration = vnfs.getCloudConfiguration(); } else { break; } for (VfModules vfModules : vnfs.getVfModules()) { if (cloudConfiguration == null) { cloudConfiguration = vfModules.getCloudConfiguration(); } else { break; } } } for (Networks networks : resources.getNetworks()) { if (cloudConfiguration == null) { cloudConfiguration = networks.getCloudConfiguration(); } else { break; } } } if (cloudConfiguration != null) { org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } else { logger.debug("Could not find any cloud configuration for this request."); return null; } }  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 testgetGBBMacroCloudConfiguration() throws Exception { org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue( new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class); CloudConfiguration cloudConfig = null; org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion(); aaiCloudRegion.setCloudOwner("test-owner-name"); Resources resources = serviceMacro.getResources(); doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class)); CloudRegion expected = new CloudRegion(); expected.setLcpCloudRegionId("mdt1"); expected.setCloudOwner("test-owner-name"); expected.setTenantId("88a6ca3ee0394ade9403f075db23167e"); CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); assertThat(actual, sameBeanAs(expected)); serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVnfs.json"), org.onap.so.serviceinstancebeans.Service.class); resources = serviceMacro.getResources(); actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); assertThat(actual, sameBeanAs(expected)); serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNetworks.json"), org.onap.so.serviceinstancebeans.Service.class); resources = serviceMacro.getResources(); actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); assertThat(actual, sameBeanAs(expected)); serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNoCloudConfig.json"), org.onap.so.serviceinstancebeans.Service.class); resources = serviceMacro.getResources(); actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); assertNull(actual); }