Token { @Override public boolean equals(Object obj) { if (obj instanceof Token) { return equalToken((Token) obj); } return false; } Token(int index, int length, Object value); int length(); int index(); Object value(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() { ObjectTester.assertEqual(new Token(1, 2, "value"), new Token(1, 2, "value")); ObjectTester.assertEqual(new Token(1, 2, null), new Token(1, 2, null)); ObjectTester.assertNotEqual(new Token(1, 2, "value"), new Token(2, 2, "value"), new Token(1, 3, "value"), new Token(1, 2, "value2"), new Token(1, 2, null)); }