EmbeddedPackageInstallable implements SlingOpenable<JcrPackage> { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final EmbeddedPackageInstallable that = (EmbeddedPackageInstallable) o; return parentId.equals(that.parentId) && jcrPath.equals(that.jcrPath) && embeddedId.equals(that.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 testEquals() { EmbeddedPackageInstallable self = new EmbeddedPackageInstallable( PackageId.fromString("test:test:1"), "/some/path", PackageId.fromString("test:testtest:1")); assertEquals("expect self to equal self", self, self); assertFalse("expect self to not equal null", self.equals(null)); assertEquals("expect self to equal other same params", self, new EmbeddedPackageInstallable( self.getParentId(), self.getJcrPath(), self.getEmbeddedId())); assertNotEquals("expect self to equal other different path", self, new EmbeddedPackageInstallable( self.getParentId(), "/some/other/path", self.getEmbeddedId())); assertNotEquals("expect self to equal other different parent id", self, new EmbeddedPackageInstallable( self.getEmbeddedId(), self.getJcrPath(), self.getEmbeddedId())); assertNotEquals("expect self to equal other different embedded id", self, new EmbeddedPackageInstallable( self.getParentId(), self.getJcrPath(), self.getParentId())); }