本文整理汇总了Java中java.util.SimpleTimeZone.setDSTSavings方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleTimeZone.setDSTSavings方法的具体用法?Java SimpleTimeZone.setDSTSavings怎么用?Java SimpleTimeZone.setDSTSavings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.SimpleTimeZone
的用法示例。
在下文中一共展示了SimpleTimeZone.setDSTSavings方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_setDSTSavingsI
import java.util.SimpleTimeZone; //导入方法依赖的package包/类
/**
* @tests java.util.SimpleTimeZone#setDSTSavings(int)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "setDSTSavings",
args = {int.class}
)
public void test_setDSTSavingsI() {
// Test for method void java.util.SimpleTimeZone.setDSTSavings(int)
SimpleTimeZone st = new SimpleTimeZone(1000, "Test_TZ");
st.setStartRule(0, 1, 1, 1);
st.setEndRule(11, 1, 1, 1);
st.setDSTSavings(1);
assertEquals("Daylight savings amount not set", 1, st.getDSTSavings());
}
示例2: test_setDSTSavingsI
import java.util.SimpleTimeZone; //导入方法依赖的package包/类
/**
* @tests java.util.SimpleTimeZone#setDSTSavings(int)
*/
public void test_setDSTSavingsI() {
// Test for method void java.util.SimpleTimeZone.setDSTSavings(int)
SimpleTimeZone st = new SimpleTimeZone(1000, "Test_TZ");
st.setStartRule(0, 1, 1, 1);
st.setEndRule(11, 1, 1, 1);
st.setDSTSavings(1);
assertEquals("Daylight savings amount not set", 1, st.getDSTSavings());
}
示例3: TODO
import java.util.SimpleTimeZone; //导入方法依赖的package包/类
/**
* @tests java.util.SimpleTimeZone#inDaylightTime(java.util.Date)
*
TODO(tball): enable when in daylight time tables are added.
public void test_inDaylightTimeLjava_util_Date() {
// Test for method boolean
// java.util.SimpleTimeZone.inDaylightTime(java.util.Date)
TimeZone zone = TimeZone.getTimeZone("EST");
GregorianCalendar gc = new GregorianCalendar(1998, Calendar.JUNE, 11);
assertFalse("Returned incorrect daylight value1", zone.inDaylightTime(gc
.getTime()));
gc = new GregorianCalendar(1998, Calendar.NOVEMBER, 11);
assertFalse("Returned incorrect daylight value1", zone.inDaylightTime(gc
.getTime()));
gc = new GregorianCalendar(zone);
gc.set(1999, Calendar.APRIL, 4, 1, 59, 59);
assertTrue("Returned incorrect daylight value3", !(zone
.inDaylightTime(gc.getTime())));
Date date = new Date(gc.getTime().getTime() + 1000);
assertFalse("Returned incorrect daylight value4", zone
.inDaylightTime(date));
gc.set(1999, Calendar.OCTOBER, 31, 1, 0, 0);
assertTrue("Returned incorrect daylight value5", !(zone
.inDaylightTime(gc.getTime())));
date = new Date(gc.getTime().getTime() - 1000);
assertFalse("Returned incorrect daylight value6", zone
.inDaylightTime(date));
assertTrue("Returned incorrect daylight value7", !zone
.inDaylightTime(new Date(891752400000L + 7200000 - 1)));
assertFalse("Returned incorrect daylight value8", zone
.inDaylightTime(new Date(891752400000L + 7200000)));
assertFalse("Returned incorrect daylight value9", zone
.inDaylightTime(new Date(909288000000L + 7200000 - 1)));
assertTrue("Returned incorrect daylight value10", !zone
.inDaylightTime(new Date(909288000000L + 7200000)));
}
/**
* @tests java.util.SimpleTimeZone#setDSTSavings(int)
*/
public void test_setDSTSavingsI() {
// Test for method void java.util.SimpleTimeZone.setDSTSavings(int)
SimpleTimeZone st = new SimpleTimeZone(1000, "Test_TZ");
st.setStartRule(0, 1, 1, 1);
st.setEndRule(11, 1, 1, 1);
st.setDSTSavings(1);
assertEquals("Daylight savings amount not set", 1, st.getDSTSavings());
}