### Question:
ImageCatalogVersionFilter { public String latestCloudbreakVersion(Iterable<CloudbreakVersion> cloudbreakVersions) { SortedMap<Versioned, CloudbreakVersion> sortedCloudbreakVersions = new TreeMap<>(new VersionComparator()); for (CloudbreakVersion cbv : cloudbreakVersions) { cbv.getVersions().forEach(cbvs -> sortedCloudbreakVersions.put(() -> cbvs, cbv)); } return sortedCloudbreakVersions.lastKey().getVersion(); }  Set<CloudbreakVersion> filterReleasedVersions(Collection<CloudbreakVersion> cloudbreakVersions, String releasedVersion); Set<CloudbreakVersion> filterUnreleasedVersions(Collection<CloudbreakVersion> cloudbreakVersions, String unReleasedVersion); String latestCloudbreakVersion(Iterable<CloudbreakVersion> cloudbreakVersions); boolean isVersionUnspecified(String cbVersion); String extractUnreleasedVersion(String cbVersion); String extractReleasedVersion(String cbVersion); String extractExtendedUnreleasedVersion(String cbVersion);  }### Answer:
@Test public void getLatestCloudbreakVersion() { List<String> list1 = generateVersionList(devVersion, unReleasedVersion); List<String> list2 = generateVersionList(releasedVersion, extendedUnreleasedVersion); versions = generateCloudBreakVersions(list1, list2); assertEquals("2.8.0-rev.82", underTest.latestCloudbreakVersion(versions)); }
@Test public void getLatestCloudbreakVersionWhenREVersioningExistsAndNewest() { List<String> list1 = generateVersionList(devVersion, unReleasedVersion); List<String> list2 = generateVersionList(releasedVersion, extendedUnreleasedVersion); List<String> rEVersionList = generateVersionList(rEVersionOlder, rEVersionNewest); versions = generateCloudBreakVersions(list1, list2, rEVersionList); String actual = underTest.latestCloudbreakVersion(versions); assertEquals("2.8.0-b83", actual); }
@Test public void getLatestCloudbreakVersionWhenREVersioningExistsAndNotNewest() { List<String> list1 = generateVersionList(devVersion, unReleasedVersion); List<String> list2 = generateVersionList(rEVersionOlder, extendedUnreleasedVersion); versions = generateCloudBreakVersions(list1, list2); String actual = underTest.latestCloudbreakVersion(versions); assertEquals("2.8.0-rev.82", actual); }