Code example for SimpleTimeZone

Methods: inDaylightTime, setEndRule, setStartRule, useDaylightTime

0
	 * @tests java.util.SimpleTimeZone#setEndRule(int, int, int, int) 
	 */ 
	public void test_setEndRuleIIII() { 
		// Test for method void java.util.SimpleTimeZone.setEndRule(int, int, 
		// int, int) 
		SimpleTimeZone st = new SimpleTimeZone(1000, "Test_TZ");
		// Spec indicates that both end and start must be set or result is 
		// undefined 
		st.setStartRule(Calendar.NOVEMBER, 1, Calendar.SUNDAY, 0);
		st.setEndRule(Calendar.NOVEMBER, -1, Calendar.SUNDAY, 0);
		assertTrue("StartRule improperly set1", st.useDaylightTime());
		assertTrue("StartRule improperly set2", st
				.inDaylightTime(new GregorianCalendar(1998, Calendar.NOVEMBER,
						13).getTime()));
		assertTrue("StartRule improperly set3", !(st
				.inDaylightTime(new GregorianCalendar(1998, Calendar.OCTOBER,
						13).getTime())));
	} 
 
	/** 
	 * @tests java.util.SimpleTimeZone#setEndRule(int, int, int, int, boolean)