@Test
public void testEquals() {

    final Endpoint a = new Endpoint("foo", "bar", 1);
    final Endpoint b = new Endpoint("foo", "bar", 1);
    assertThat(a.equals(b), is(true));
    assertThat(b.equals(a), is(true));
    assertThat(b.hashCode(), is(a.hashCode()));
    final Endpoint c = new Endpoint("bar", "foo", 1);
    assertThat(a.equals(c), is(false));
    assertThat(b.equals(c), is(false));
    final Endpoint d = new Endpoint("foo", "bar", 2);
    assertThat(a.equals(d), is(false));
    final Endpoint e = new Endpoint("foo", "baz", 1);
    assertThat(a.equals(e), is(false));
    assertThat(a.equals(null), is(false));
    assertThat(a.equals("some string"), is(false));
}