Code example for Date

Methods: setSeconds

0
     * Test of the (deprecated) Date.setSeconds( int ) method - which always 
     * throws an IllegalArgumentException 
     */ 
    @SuppressWarnings("deprecation") 
    public void testSetSeconds() { 
        Date theDate = new Date(TIME_TESTDATE1);
        try { 
            theDate.setSeconds(36);
            fail("Should throw IllegalArgumentException.");
        } catch (IllegalArgumentException ie) {
            // expected 
        } // end try 
    } // end method testSetSeconds( int ) 
 
    /* 
     * Test of the String Date.toString() method This method is sensitive to the 
     * time zone setting and this test sets the time zone before calling the 
     * toString() method. 
     */ 
    public void testToString() { 
		// Loop through the timezones testing the String conversion for each