VersionInfoLoader { public static List<VersionInfo> load() throws IOException { URL url = new URL(VERSION_TXT_URL); List<VersionInfo> versionInfo = new ArrayList<>(); try (Scanner websiteScanner = new Scanner(url.openStream())) { while (websiteScanner.hasNextLine()) { checkLine(websiteScanner).ifPresent(lineParts -> { boolean release = lineParts[0].equals("REL"); Version version = new Version(lineParts[1]); String downloadUrl = lineParts[2]; String changeLogUrl = lineParts[3]; versionInfo.add(new VersionInfo(release, version, downloadUrl, changeLogUrl)); }); } } Collections.sort(versionInfo); return versionInfo; } private  VersionInfoLoader(); static List<VersionInfo> load();  }
@Test void versionLoaderTest() throws IOException { List<VersionInfo> versions = VersionInfoLoader.load(); VersionInfo oldest = versions.get(versions.size() - 1); assertEquals(new Version("4.1.7"), oldest.getVersion()); assertTrue(oldest.isRelease()); }