### Question:
AvailableBuildsList { public synchronized void updateBuildsWithSuccessfullyImportedBuilds(final List<BranchBuilds> branchBuildsList, final Map<BuildIdentifier, BuildImportSummary> buildImportSummaries) { List<BranchBuilds> result = new ArrayList<BranchBuilds>(); for (BranchBuilds branchBuilds : branchBuildsList) { BranchBuilds resultBranchBuilds = new BranchBuilds(); resultBranchBuilds.setBranch(branchBuilds.getBranch()); List<BuildLink> resultBuilds = new ArrayList<BuildLink>(); resultBranchBuilds.setBuilds(resultBuilds); for (BuildLink buildLink : branchBuilds.getBuilds()) { BuildIdentifier buildIdentifier = new BuildIdentifier(branchBuilds.getBranch().getName(), buildLink .getBuild().getName()); BuildImportSummary summary = buildImportSummaries.get(buildIdentifier); if (summary != null && summary.getStatus().isSuccess()) { resultBuilds.add(buildLink); } } updateAliasesForRecentBuilds(resultBranchBuilds); BuildSorter.sort(resultBranchBuilds.getBuilds()); result.add(resultBranchBuilds); } updateBuilds(result); logAvailableBuildsInformation(); }  synchronized List<BranchBuilds> getBranchBuildsList(); synchronized BranchBuilds getBranchBuilds(final String branchName); synchronized void updateBuildsWithSuccessfullyImportedBuilds(final List<BranchBuilds> branchBuildsList,
			final Map<BuildIdentifier, BuildImportSummary> buildImportSummaries); synchronized void refreshAliases(); synchronized void addImportedBuild(final BuildImportSummary buildImportSummary); void removeBuild(final BuildIdentifier buildIdentifier); String resolveAliasBuildName(final String branchName, final String buildName); void logAvailableBuildsInformation();  }### Answer:
@Test void testUpdatingAvailableBuildsFromNoSuccessfullyImported() { List<BranchBuilds> branchBuilds = new ArrayList<>(Arrays.asList( createBranchBuilds("trunk", build5, build1, build6, build3, build7), createBranchBuilds("branch", build2, build4))); Map<BuildIdentifier, BuildImportSummary> buildImportSummaries = createBuildImportSummaries(branchBuilds); availableBuildsList.updateBuildsWithSuccessfullyImportedBuilds(branchBuilds, buildImportSummaries); assertNumberOfBuilds("trunk", 0); assertNumberOfBuilds("branch", 0); }
@Test void testUpdatingAvailableBuildsFromSuccessfullyImported() { List<BranchBuilds> branchBuilds = new ArrayList<>(Arrays.asList( createBranchBuilds("trunk", build5, build1, build6, build3, build7), createBranchBuilds("branch", build2, build4))); Map<BuildIdentifier, BuildImportSummary> buildImportSummaries = createBuildImportSummaries(branchBuilds, "build1", "build2", "build3", "build4", "build5"); availableBuildsList.updateBuildsWithSuccessfullyImportedBuilds(branchBuilds, buildImportSummaries); assertNumberOfBuilds("trunk", 5); assertAliasContainedAtPosition("trunk", DEFAULT_ALIAS_FOR_LAST_SUCCESSFUL_BUILD, 0, build3.getBuild()); assertAliasContainedAtPosition("trunk", DEFAULT_ALIAS_FOR_MOST_RECENT_BUILD, 1, build5.getBuild()); assertBuildContainedAtPosition("trunk", 2, build5); assertBuildContainedAtPosition("trunk", 4, build1); assertNumberOfBuilds("branch", 4); assertAliasContainedAtPosition("branch", DEFAULT_ALIAS_FOR_LAST_SUCCESSFUL_BUILD, 0, build2.getBuild()); assertAliasContainedAtPosition("branch", DEFAULT_ALIAS_FOR_MOST_RECENT_BUILD, 1, build4.getBuild()); assertBuildContainedAtPosition("branch", 2, build4); assertBuildContainedAtPosition("branch", 3, build2); }