Code example for Date

Methods: getSeconds

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