Code example for TimeZone

Methods: setDefault

0
 
    // Reset defualt timezone 
    TimeZone defaultTimeZone = TimeZone.getDefault();
     
    protected void tearDown(){ 
    	TimeZone.setDefault(defaultTimeZone);
    } 
 
    /** 
     * @tests overriding Timestamp to create an immutable class. 
     */ 
    public void testOverridingTimestamp() { 
        Timestamp ts = new Timestamp(8392418){
            @Override 
            public void setNanos(int n) {
                throw new RuntimeException("Overridden method shouldn't be called");
            } 
        }; 
    } 
} // end class TimestampTest 
Experience pair programming with AI  Get Codota for Java