Move { @Override public boolean equals(Object o) { if ((o == null) || (o.getClass() != this.getClass())) return false; Move other = (Move)o; if (from != other.from) return false; if (to != other.to) return false; if (promoteTo != other.promoteTo) return false; return true; } Move(int from, int to, int promoteTo);  Move(int from, int to, int promoteTo, int score);  Move(Move m); final void copyFrom(Move m); final void clear(); final void setMove(int from, int to, int promoteTo, int score); @Override boolean equals(Object o); @Override int hashCode(); final String toString(); public int from; public int to; public int promoteTo; public int score; }
@Test public void testEquals() { System.out.println("equals"); Move m1 = new Move(Position.getSquare(0, 6), Position.getSquare(1, 7), Piece.WROOK); Move m2 = new Move(Position.getSquare(0, 6), Position.getSquare(0, 7), Piece.WROOK); Move m3 = new Move(Position.getSquare(1, 6), Position.getSquare(1, 7), Piece.WROOK); Move m4 = new Move(Position.getSquare(0, 6), Position.getSquare(1, 7), Piece.WKNIGHT); Move m5 = new Move(Position.getSquare(0, 6), Position.getSquare(1, 7), Piece.WROOK); assertTrue(!m1.equals(m2)); assertTrue(!m1.equals(m3)); assertTrue(!m1.equals(m4)); assertTrue(m1.equals(m5)); }