Code example for Date

Methods: getHours

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