Code example for Timestamp

Methods: hashCode

0
 
    /* 
     * Class under test for String hashCode() 
     */ 
    public void testHashCode() { 
        Timestamp one = new Timestamp(now, cpath);
        Timestamp two = new Timestamp(now, cpath);
        Timestamp three = new Timestamp(now, new MyCertPath(new byte[] { 10,
                20, 30 })); 
        Timestamp four = null;
 
        assertTrue(one.hashCode() == two.hashCode());
        assertTrue(one.hashCode() != three.hashCode());
        assertTrue(two.hashCode() != three.hashCode());
 
        try { 
            four.hashCode();
            fail("NullPointerException expected");
        } catch (NullPointerException e) {
            // expected