### Question:
StackResponseUtils { public Map<String, String> getCloudInstanceIdsForHostGroup(StackV4Response stackResponse, String hostGroup) { return stackResponse.getInstanceGroups().stream() .filter(instanceGroupV4Response -> instanceGroupV4Response.getName().equalsIgnoreCase(hostGroup)) .flatMap(instanceGroupV4Response -> instanceGroupV4Response.getMetadata().stream()) .filter(instanceMetaData -> instanceMetaData.getDiscoveryFQDN() != null) .collect(Collectors.toMap(InstanceMetaDataV4Response::getDiscoveryFQDN, InstanceMetaDataV4Response::getInstanceId)); }  Optional<InstanceMetaDataV4Response> getNotTerminatedPrimaryGateways(StackV4Response stackResponse); Map<String, String> getCloudInstanceIdsForHostGroup(StackV4Response stackResponse, String hostGroup); Integer getNodeCountForHostGroup(StackV4Response stackResponse, String hostGroup); String getRoleConfigNameForHostGroup(StackV4Response stackResponse, String hostGroupName, String serviceType, String roleType);  }### Answer:
@Test public void testGetCloudInstanceIdsForHostGroup() { String hostGroup = "compute"; Map<String, String> instanceIdsForHostGroups = underTest .getCloudInstanceIdsForHostGroup(getMockStackV4Response(hostGroup), hostGroup); assertEquals("Retrieved Instance Ids size should match", instanceIdsForHostGroups.size(), 3); assertEquals("Retrieved Instance Id should match", instanceIdsForHostGroups.get("test_fqdn1"), "test_instanceid_compute1"); assertEquals("Retrieved Instance Id should match", instanceIdsForHostGroups.get("test_fqdn2"), "test_instanceid_compute2"); assertEquals("Retrieved Instance Id should match", instanceIdsForHostGroups.get("test_fqdn3"), "test_instanceid_compute3"); }