Insert extends Operation { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Insert)) { return false; } Insert that = (Insert) other; return Objects.equals(table, that.getTable()) && Objects.equals(row, that.getRow()) && Objects.equals(uuidName, that.getUuidName()); } Insert(String table, Row row);  Insert(String table, Row row, String uuidName); Insert withUuidName(String uuidName); String getTable(); Row getRow(); String getUuidName(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { Row row = mock(Row.class); String tableName = "table"; new EqualsTester() .addEqualityGroup(new Insert(tableName, row), new Insert(tableName, row, null)) .addEqualityGroup( new Insert(tableName, row, "uuid-name"), new Insert(tableName, row).withUuidName("uuid-name") ).testEquals(); }