@Test public void testEquals() { assertFalse(getTestObject().equals(null)); assertFalse(getTestObject().equals("DummyString")); assertTrue(getTestObject().equals(getTestObject())); Rating sameObject = getTestObject(); assertTrue(sameObject.equals(sameObject)); Rating differentObject = getTestObject(); differentObject.setUser("Different"); assertFalse(getTestObject().equals(differentObject)); differentObject = getTestObject(); differentObject.setGUID("Different"); assertFalse(getTestObject().equals(differentObject)); }
@Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } if (!super.equals(objectToCompare)) { return false; } Rating rating = (Rating) objectToCompare; return isPublic() == rating.isPublic() && getStarRating() == rating.getStarRating() && Objects.equals(getReview(), rating.getReview()) && Objects.equals(getUser(), rating.getUser()); }
Rating extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } if (!super.equals(objectToCompare)) { return false; } Rating rating = (Rating) objectToCompare; return isPublic() == rating.isPublic() && getStarRating() == rating.getStarRating() && Objects.equals(getReview(), rating.getReview()) && Objects.equals(getUser(), rating.getUser()); } }
Rating extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } if (!super.equals(objectToCompare)) { return false; } Rating rating = (Rating) objectToCompare; return isPublic() == rating.isPublic() && getStarRating() == rating.getStarRating() && Objects.equals(getReview(), rating.getReview()) && Objects.equals(getUser(), rating.getUser()); } Rating();  Rating(Rating template); }
Rating extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } if (!super.equals(objectToCompare)) { return false; } Rating rating = (Rating) objectToCompare; return isPublic() == rating.isPublic() && getStarRating() == rating.getStarRating() && Objects.equals(getReview(), rating.getReview()) && Objects.equals(getUser(), rating.getUser()); } Rating();  Rating(Rating template); String getUser(); void setUser(String user); StarRating getStarRating(); void setStarRating(StarRating starRating); String getReview(); void setReview(String review); boolean isPublic(); void setPublic(boolean aPublic); @Override String toString(); @Override boolean equals(Object objectToCompare); }
Rating extends ElementHeader { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } if (!super.equals(objectToCompare)) { return false; } Rating rating = (Rating) objectToCompare; return isPublic() == rating.isPublic() && getStarRating() == rating.getStarRating() && Objects.equals(getReview(), rating.getReview()) && Objects.equals(getUser(), rating.getUser()); } Rating();  Rating(Rating template); String getUser(); void setUser(String user); StarRating getStarRating(); void setStarRating(StarRating starRating); String getReview(); void setReview(String review); boolean isPublic(); void setPublic(boolean aPublic); @Override String toString(); @Override boolean equals(Object objectToCompare);  }