PackageManagerOperationResolverImpl implements PackageManagerOperationResolver { protected boolean isSamePackage(Package pkg, Package other) { LOG.trace("isSamePackage: ", pkg, other); return pkg == other || (pkg.getName().equals(other.getName()) && pkg.getVersion().equals(other.getVersion())); } PackageManagerOperationResolverImpl(Supplier<Collection<Package>> installedPackagesSupplier,
                                             Supplier<Collection<Package>> availablePackagesSupplier); @Override ResolveState resolve(Collection<Package> packagesToInstall, Collection<Package> packagesToUninstall); @Override boolean isValid(ResolveState resolveState);  }
@Test public void testIsSamePackage() throws Exception { final PackageManagerOperationResolverImpl r = resolver(); assertTrue(r.isSamePackage(createPackage("pkg1", "1.0-1"), createPackage("pkg1", "1.0-1"))); assertFalse(r.isSamePackage(createPackage("pkg1", "1.0-1"), createPackage("pkg2", "1.0-1"))); assertFalse(r.isSamePackage(createPackage("pkg1", "1.0-1"), createPackage("pkg1", "1.0-2"))); }