@Test public void testEquals() { assertFalse(getTestObject().equals(null)); assertFalse(getTestObject().equals("DummyString")); assertTrue(getTestObject().equals(getTestObject())); Like sameObject = getTestObject(); assertTrue(sameObject.equals(sameObject)); Like differentObject = getTestObject(); differentObject.setGUID("Different"); assertFalse(getTestObject().equals(differentObject)); }
@Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Like)) { return false; } if (!super.equals(objectToCompare)) { return false; } Like like = (Like) objectToCompare; return isPublic() == like.isPublic() && Objects.equals(getUser(), like.getUser()); }
Like extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Like)) { return false; } if (!super.equals(objectToCompare)) { return false; } Like like = (Like) objectToCompare; return isPublic() == like.isPublic() && Objects.equals(getUser(), like.getUser()); } }
Like extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Like)) { return false; } if (!super.equals(objectToCompare)) { return false; } Like like = (Like) objectToCompare; return isPublic() == like.isPublic() && Objects.equals(getUser(), like.getUser()); } Like();  Like(Like template); }
Like extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Like)) { return false; } if (!super.equals(objectToCompare)) { return false; } Like like = (Like) objectToCompare; return isPublic() == like.isPublic() && Objects.equals(getUser(), like.getUser()); } Like();  Like(Like template); String getUser(); void setUser(String user); boolean isPublic(); void setPublic(boolean aPublic); @Override String toString(); @Override boolean equals(Object objectToCompare); }
Like extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Like)) { return false; } if (!super.equals(objectToCompare)) { return false; } Like like = (Like) objectToCompare; return isPublic() == like.isPublic() && Objects.equals(getUser(), like.getUser()); } Like();  Like(Like template); String getUser(); void setUser(String user); boolean isPublic(); void setPublic(boolean aPublic); @Override String toString(); @Override boolean equals(Object objectToCompare);  }