Comment extends Operation { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Comment)) { return false; } Comment that = (Comment) other; return Objects.equals(comment, that.getComment()); } Comment(String comment); String getComment(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { new EqualsTester() .addEqualityGroup(new Comment("comment"), new Comment("comment")) .testEquals(); }