Code example for Date

Methods: setHours

0
     * Test of the (deprecated) Date.setHours( int ) method - which always 
     * throws an IllegalArgumentException 
     */ 
    @SuppressWarnings("deprecation") 
    public void testSetHours() { 
        Date theDate = new Date(TIME_TESTDATE1);
        try { 
            theDate.setHours(22);
            fail("Should throw IllegalArgumentException.");
        } catch (IllegalArgumentException ie) {
            // expected 
        } // end try 
    } // end method testSetHours( int ) 
 
    /* 
     * Test of the (deprecated) Date.setMinutes( int ) method - which always 
     * throws an IllegalArgumentException 
     */ 
    @SuppressWarnings("deprecation") 
    public void testSetMinutes() { 
        Date theDate = new Date(TIME_TESTDATE1);