@Test public void testEquals() { assertFalse(getTestObject().equals("DummyString")); assertTrue(getTestObject().equals(getTestObject())); CommentRequestBody sameObject = getTestObject(); assertTrue(sameObject.equals(sameObject)); CommentRequestBody differentObject = getTestObject(); differentObject.setCommentType(CommentType.ANSWER); assertFalse(getTestObject().equals(differentObject)); }
@Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } CommentRequestBody that = (CommentRequestBody) objectToCompare; return isPublic() == that.isPublic() && getCommentType() == that.getCommentType() && Objects.equals(getCommentText(), that.getCommentText()); }
CommentRequestBody extends FeedbackRequestBody { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } CommentRequestBody that = (CommentRequestBody) objectToCompare; return isPublic() == that.isPublic() && getCommentType() == that.getCommentType() && Objects.equals(getCommentText(), that.getCommentText()); } }
CommentRequestBody extends FeedbackRequestBody { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } CommentRequestBody that = (CommentRequestBody) objectToCompare; return isPublic() == that.isPublic() && getCommentType() == that.getCommentType() && Objects.equals(getCommentText(), that.getCommentText()); } CommentRequestBody();  CommentRequestBody(CommentRequestBody template); }
CommentRequestBody extends FeedbackRequestBody { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } CommentRequestBody that = (CommentRequestBody) objectToCompare; return isPublic() == that.isPublic() && getCommentType() == that.getCommentType() && Objects.equals(getCommentText(), that.getCommentText()); } CommentRequestBody();  CommentRequestBody(CommentRequestBody template); CommentType getCommentType(); void setCommentType(CommentType commentType); String getCommentText(); void setCommentText(String commentText); @Override String toString(); @Override boolean equals(Object objectToCompare); @Override int hashCode(); }
CommentRequestBody extends FeedbackRequestBody { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } CommentRequestBody that = (CommentRequestBody) objectToCompare; return isPublic() == that.isPublic() && getCommentType() == that.getCommentType() && Objects.equals(getCommentText(), that.getCommentText()); } CommentRequestBody();  CommentRequestBody(CommentRequestBody template); CommentType getCommentType(); void setCommentType(CommentType commentType); String getCommentText(); void setCommentText(String commentText); @Override String toString(); @Override boolean equals(Object objectToCompare); @Override int hashCode();  }