DownloadOSFamily implements Comparable<DownloadOSFamily> { public DownloadOS findDownload(final String name) { final int idx = downloads.indexOf(new DownloadOS(name)); if (idx < 0) { return null; } return downloads.get(idx); } DownloadOSFamily(final String name);  DownloadOSFamily(final String name, final List<DownloadOS> downloads); final String getName(); final List<DownloadOS> getDownloads(); DownloadOS findDownload(final String name); DownloadOS findLatestDownload(final String qualifier); @Override final int hashCode(); @Override final boolean equals(final Object obj); @Override final int compareTo(final DownloadOSFamily other); @Override final String toString();  }
@Test public void testFindDownload() { final String name = "Linux"; final DownloadOSFamily testee = new DownloadOSFamily(name); final DownloadOS v16 = new DownloadOS("Ubuntu 16.04 64-bit (.deb)", "https: final DownloadOS v18 = new DownloadOS("Ubuntu 18.04 64-bit (.deb)", "https: testee.addOS(v16); testee.addOS(v18); testee.seal(); final DownloadOS download = testee.findDownload("Ubuntu 16.04 64-bit (.deb)"); assertThat(download).isSameAs(v16); }