@Test
    public void requireThatEqualsAndHashCodeWorks() {
        DocumentTypeId r1 = new DocumentTypeId(123);
        DocumentTypeId r2 = new DocumentTypeId(123);
        DocumentTypeId r3 = new DocumentTypeId(456);

        assertEquals(r1, r1);
        assertEquals(r1, r2);
        assertEquals(r2, r1);
        assertEquals(r1.hashCode(), r2.hashCode());

        assertNotEquals(r1, r3);
        assertNotEquals(r3, r1);
        assertNotEquals(r2, r3);
        assertNotEquals(r3, r2);
        assertNotEquals(r1.hashCode(), r3.hashCode());

        assertNotEquals(r1, new Object());
        assertFalse(r1.equals("foobar"));
    }
@author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
@since 5.1.10
document/src/test/java/com/yahoo/document/DocumentTypeIdTestCase.java