UpdateDatabase implements ProgressTask<PackageListUpdateReport> { protected boolean packageMetadataEquals(Package p1, Package p2) { return Objects.equals(p1.getSource(), p2.getSource()) && Objects.equals(p1.getName(), p2.getName()) && Objects.equals(p1.getVersion(), p2.getVersion()); } UpdateDatabase(PackageManagerConfiguration configuration, SourcesList sourcesList, PackageManagerDatabase db, DownloadManager downloadManager); @Override ProgressTaskDescription getDescription(Locale locale); @Override PackageListUpdateReport execute(ProgressReceiver progressReceiver);  }
@Test public void testPackageMetadataEquals() { final UpdateDatabase updater = createUpdateDatabase(); final Source s1 = createSource("http: final Source s2 = createSource("http: assertTrue(updater.packageMetadataEquals( createPackage("foo", "2.1-1", false, s1), createPackage("foo", "2.1-1", true, s1) )); assertFalse(updater.packageMetadataEquals( createPackage("foo", "2.0-1", false, s1), createPackage("foo", "2.1-1", false, s1) )); assertFalse(updater.packageMetadataEquals( createPackage("bar", "2.1-1", false, s1), createPackage("foo", "2.1-1", false, s1) )); assertFalse(updater.packageMetadataEquals( createPackage("foo", "2.1-1", false, s1), createPackage("foo", "2.1-1", false, s2) )); }