EmbeddedPackageInstallable implements SlingOpenable<JcrPackage> { @Override public int hashCode() { return Objects.hash(parentId, jcrPath, embeddedId); } EmbeddedPackageInstallable(final @NotNull PackageId parentId,
                                      final @NotNull String jcrPath,
                                      final @NotNull PackageId embeddedId); @NotNull @Override PackageId getParentId(); @NotNull @Override String getJcrPath(); @NotNull PackageId getEmbeddedId(); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void testHashCode() { EmbeddedPackageInstallable self = new EmbeddedPackageInstallable( PackageId.fromString("test:test:1"), "/some/path", PackageId.fromString("test:testtest:1")); assertEquals("expect self to equal self", self.hashCode(), self.hashCode()); assertEquals("expect self to equal other same params", self.hashCode(), new EmbeddedPackageInstallable( self.getParentId(), self.getJcrPath(), self.getEmbeddedId()).hashCode()); assertNotEquals("expect self to equal other different path", self.hashCode(), new EmbeddedPackageInstallable( self.getParentId(), "/some/other/path", self.getEmbeddedId()).hashCode()); assertNotEquals("expect self to equal other different parent id", self.hashCode(), new EmbeddedPackageInstallable( self.getEmbeddedId(), self.getJcrPath(), self.getEmbeddedId()).hashCode()); assertNotEquals("expect self to equal other different embedded id", self.hashCode(), new EmbeddedPackageInstallable( self.getParentId(), self.getJcrPath(), self.getParentId()).hashCode()); }