@Test public void testEquals() throws Exception { String id ="user"; String dn ="someDn"; String email="user@email.com"; String name ="User Name"; FideliusUserEntry fideliusUserEntry1 = new FideliusUserEntry(id,dn, email,name); FideliusUserEntry fideliusUserEntry2 = new FideliusUserEntry(id,dn, email,name); FideliusUserEntry fideliusUserEntry3 = new FideliusUserEntry("hello", dn,email,name); FideliusUserEntry fideliusUserEntry5 = new FideliusUserEntry(id, dn, "I",name); FideliusUserEntry fideliusUserEntry6 = new FideliusUserEntry(id, dn, email,"test"); FideliusUserEntry fideliusUserEntry7 = new FideliusUserEntry(id, "newDn", email,"test"); Assert.assertEquals("Self Check", fideliusUserEntry1, fideliusUserEntry1); Assert.assertEquals("Different but Same Objects", fideliusUserEntry1, fideliusUserEntry2); Assert.assertNotEquals("Different Objects", fideliusUserEntry1, "HI"); Assert.assertNotEquals("Different id", fideliusUserEntry1, fideliusUserEntry3); Assert.assertNotEquals("Different email", fideliusUserEntry1, fideliusUserEntry5); Assert.assertNotEquals("Different name", fideliusUserEntry1, fideliusUserEntry6); Assert.assertNotEquals("Different role", fideliusUserEntry1, fideliusUserEntry7); Assert.assertNotEquals("Different role", fideliusUserEntry1, fideliusUserEntry7); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FideliusUserEntry that = (FideliusUserEntry) o; return Objects.equal(userId, that.userId) && Objects.equal(email, that.email) && Objects.equal(name, that.name)&& Objects.equal(dn, that.dn); }
FideliusUserEntry { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FideliusUserEntry that = (FideliusUserEntry) o; return Objects.equal(userId, that.userId) && Objects.equal(email, that.email) && Objects.equal(name, that.name)&& Objects.equal(dn, that.dn); } }
FideliusUserEntry { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FideliusUserEntry that = (FideliusUserEntry) o; return Objects.equal(userId, that.userId) && Objects.equal(email, that.email) && Objects.equal(name, that.name)&& Objects.equal(dn, that.dn); } FideliusUserEntry(String userId, String dn, String email, String name); }
FideliusUserEntry { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FideliusUserEntry that = (FideliusUserEntry) o; return Objects.equal(userId, that.userId) && Objects.equal(email, that.email) && Objects.equal(name, that.name)&& Objects.equal(dn, that.dn); } FideliusUserEntry(String userId, String dn, String email, String name); String getUserId(); String getEmail(); String getName(); String getDn(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
FideliusUserEntry { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FideliusUserEntry that = (FideliusUserEntry) o; return Objects.equal(userId, that.userId) && Objects.equal(email, that.email) && Objects.equal(name, that.name)&& Objects.equal(dn, that.dn); } FideliusUserEntry(String userId, String dn, String email, String name); String getUserId(); String getEmail(); String getName(); String getDn(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }