### Question:
RepoUtil { public static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos, @Nullable String versionDefinitionId, @Nullable String stackName, @Nullable String stackVersion) { List<RepositoryResponse> responses = new ArrayList<>(repositoryInfos.size()); for (RepositoryInfo repoInfo: repositoryInfos) { RepositoryResponse response = repoInfo.convertToResponse(); response.setVersionDefinitionId(versionDefinitionId); response.setStackName(stackName); response.setStackVersion(stackVersion); responses.add(response); } return responses; }  static RepositoryFolderAndXml parseRepoFile(File directory,
                                                 Collection<String> subDirs,
                                                 ModuleFileUnmarshaller unmarshaller); @Experimental(feature = ExperimentalFeature.CUSTOM_SERVICE_REPOS, comment = "Remove logic for handling custom service repos after enabling multi-mpack cluster deployment") static boolean addServiceReposToOperatingSystemEntities(List<RepoOsEntity> operatingSystems,
                                                                 ListMultimap<String, RepositoryInfo> stackReposByOs); @Experimental(feature = ExperimentalFeature.CUSTOM_SERVICE_REPOS, comment = "Remove logic for handling custom service repos after enabling multi-mpack cluster deployment") static List<RepositoryInfo> getServiceRepos(List<RepositoryInfo> vdfRepos,
                                                   ListMultimap<String, RepositoryInfo> stackReposByOs); static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos,
                                                     @Nullable String versionDefinitionId,
                                                     @Nullable String stackName,
                                                     @Nullable String stackVersion);  }### Answer:
@Test public void testAsRepositoryResponses() { List<RepositoryInfo> repos = Lists.newArrayList(repoInfo("HDP", "HDP-2.3", "redhat6"), repoInfo("HDP-UTILS", "HDP-UTILS-1.1.0.20", "redhat6"), repoInfo("HDP", "HDP-2.3", "redhat5"), repoInfo("HDP-UTILS", "HDP-UTILS-1.1.0.20", "redhat5")); List<RepositoryResponse> responses = RepoUtil.asResponses(repos, "HDP-2.3", "HDP", "2.3"); Assert.assertEquals("Wrong number of responses", repos.size(), responses.size()); for (RepositoryResponse response: responses) { Assert.assertEquals("Unexpected version definition id", "HDP-2.3", response.getVersionDefinitionId()); Assert.assertEquals("Unexpected stack name", "HDP", response.getStackName()); Assert.assertEquals("Unexpected stack version", "2.3", response.getStackVersion()); } }