### Question:
ObjectProperty implements Serializable { @Override public boolean equals(Object obj) { if (obj instanceof ObjectProperty) { ObjectProperty other = (ObjectProperty)obj; return Objects.equals(object, other.object) && index == other.index && Objects.equals(property, other.property); } return false; } ObjectProperty(Object object, @CheckForNull String property, int index);  ObjectProperty(Object object, String property);  ObjectProperty(Object object); Object getObject(); @CheckForNull String getProperty(); int getIndex(); boolean hasIndex(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEquals() { ObjectProperty objectProperty = new ObjectProperty("foo"); assertThat(objectProperty, is(equalTo(objectProperty))); assertThat(new ObjectProperty("foo"), is(equalTo(new ObjectProperty("foo")))); assertThat(new ObjectProperty("foo", "bar"), is(equalTo(new ObjectProperty("foo", "bar")))); assertThat(new ObjectProperty("foo", "bar", 1), is(equalTo(new ObjectProperty("foo", "bar", 1)))); assertThat(new ObjectProperty("foo", "bar", 1), is(not(equalTo(new ObjectProperty("foo", "bar", 2))))); assertThat(new ObjectProperty("foo", "bar", 1), is(not(equalTo(new ObjectProperty("foo", "bar"))))); assertThat(new ObjectProperty("foo", "bar"), is(not(equalTo(new ObjectProperty("foo", "bar", 1))))); assertThat(new ObjectProperty("foo", "bar", 1), is(not(equalTo(new ObjectProperty("foo"))))); assertThat(new ObjectProperty("foo"), is(not(equalTo(new ObjectProperty("foo", "bar", 1))))); assertThat(new ObjectProperty("foo", "bar"), is(not(equalTo(new ObjectProperty("foo"))))); assertThat(new ObjectProperty("foo"), is(not(equalTo(new ObjectProperty("foo", "bar"))))); assertThat(new ObjectProperty("foo", "bar"), is(not(equalTo(new ObjectProperty("foo", "baz"))))); assertThat(new ObjectProperty("foo", "bar", 1), is(not(equalTo(new ObjectProperty("foo", "baz", 1))))); assertThat(new ObjectProperty("foo", "bar", 1), is(not(equalTo(new ObjectProperty("baz", "bar", 1))))); assertThat(new ObjectProperty("foo", "bar"), is(not(equalTo(new ObjectProperty("baz", "bar"))))); assertThat(new ObjectProperty("foo"), is(not(equalTo(new ObjectProperty("baz"))))); assertThat(new ObjectProperty("foo"), is(not(equalTo("foo")))); }