@Test public void testEquals() { assertFalse(getTestObject().equals(null)); assertFalse(getTestObject().equals("DummyString")); assertTrue(getTestObject().equals(getTestObject())); Comment sameObject = getTestObject(); assertTrue(sameObject.equals(sameObject)); Comment differentObject = getTestObject(); differentObject.setGUID("Different"); assertFalse(getTestObject().equals(differentObject)); differentObject = getTestObject(); differentObject.setUser("Different"); assertFalse(getTestObject().equals(differentObject)); }
@Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Comment)) { return false; } if (!super.equals(objectToCompare)) { return false; } Comment comment = (Comment) objectToCompare; return getCommentType() == comment.getCommentType() && Objects.equals(getCommentText(), comment.getCommentText()) && Objects.equals(isPublic(), comment.isPublic()) && Objects.equals(getUser(), comment.getUser()); }
Comment extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Comment)) { return false; } if (!super.equals(objectToCompare)) { return false; } Comment comment = (Comment) objectToCompare; return getCommentType() == comment.getCommentType() && Objects.equals(getCommentText(), comment.getCommentText()) && Objects.equals(isPublic(), comment.isPublic()) && Objects.equals(getUser(), comment.getUser()); } }
Comment extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Comment)) { return false; } if (!super.equals(objectToCompare)) { return false; } Comment comment = (Comment) objectToCompare; return getCommentType() == comment.getCommentType() && Objects.equals(getCommentText(), comment.getCommentText()) && Objects.equals(isPublic(), comment.isPublic()) && Objects.equals(getUser(), comment.getUser()); } Comment();  Comment(Comment template); }
Comment extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Comment)) { return false; } if (!super.equals(objectToCompare)) { return false; } Comment comment = (Comment) objectToCompare; return getCommentType() == comment.getCommentType() && Objects.equals(getCommentText(), comment.getCommentText()) && Objects.equals(isPublic(), comment.isPublic()) && Objects.equals(getUser(), comment.getUser()); } Comment();  Comment(Comment template); CommentType getCommentType(); void setCommentType(CommentType commentType); String getCommentText(); void setCommentText(String commentText); String getUser(); void setUser(String user); boolean isPublic(); void setPublic(boolean aPublic); @Override String toString(); @Override boolean equals(Object objectToCompare); }
Comment extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Comment)) { return false; } if (!super.equals(objectToCompare)) { return false; } Comment comment = (Comment) objectToCompare; return getCommentType() == comment.getCommentType() && Objects.equals(getCommentText(), comment.getCommentText()) && Objects.equals(isPublic(), comment.isPublic()) && Objects.equals(getUser(), comment.getUser()); } Comment();  Comment(Comment template); CommentType getCommentType(); void setCommentType(CommentType commentType); String getCommentText(); void setCommentText(String commentText); String getUser(); void setUser(String user); boolean isPublic(); void setPublic(boolean aPublic); @Override String toString(); @Override boolean equals(Object objectToCompare);  }