use of tests.support.Support_TimeZone in project j2objc by google.
the class TimeZoneTest method test_getOffset_long.
/**
* java.util.TimeZone#getOffset(long)
*/
public void test_getOffset_long() {
// Test for method int java.util.TimeZone.getOffset(long time)
// test on subclass SimpleTimeZone
TimeZone st1 = TimeZone.getTimeZone("EST");
long time1 = new GregorianCalendar(1998, Calendar.NOVEMBER, 11).getTimeInMillis();
assertEquals("T1. Incorrect offset returned", -(5 * ONE_HOUR), st1.getOffset(time1));
long time2 = new GregorianCalendar(1998, Calendar.JUNE, 11).getTimeInMillis();
st1 = TimeZone.getTimeZone("EST");
assertEquals("T2. Incorrect offset returned", -(5 * ONE_HOUR), st1.getOffset(time2));
// test on subclass Support_TimeZone, an instance with daylight savings
TimeZone tz1 = new Support_TimeZone(-5 * ONE_HOUR, true);
assertEquals("T3. Incorrect offset returned, ", -(5 * ONE_HOUR), tz1.getOffset(time1));
assertEquals("T4. Incorrect offset returned, ", -(4 * ONE_HOUR), tz1.getOffset(time2));
// an instance without daylight savings
tz1 = new Support_TimeZone(3 * ONE_HOUR, false);
assertEquals("T5. Incorrect offset returned, ", (3 * ONE_HOUR), tz1.getOffset(time1));
assertEquals("T6. Incorrect offset returned, ", (3 * ONE_HOUR), tz1.getOffset(time2));
}
use of tests.support.Support_TimeZone in project j2objc by google.
the class TimeZoneTest method test_getDSTSavings.
/**
* java.util.TimeZone#getDSTSavings()
*/
public void test_getDSTSavings() {
// Test for method int java.util.TimeZone.getDSTSavings()
// test on subclass SimpleTimeZone
TimeZone st1 = TimeZone.getTimeZone("America/New_York");
assertEquals("T1A. Incorrect daylight savings returned", ONE_HOUR, st1.getDSTSavings());
// a SimpleTimeZone with daylight savings different then 1 hour
st1 = TimeZone.getTimeZone("Australia/Lord_Howe");
assertEquals("T1B. Incorrect daylight savings returned", 1800000, st1.getDSTSavings());
// test on subclass Support_TimeZone, an instance with daylight savings
TimeZone tz1 = new Support_TimeZone(-5 * ONE_HOUR, true);
assertEquals("T2. Incorrect daylight savings returned", ONE_HOUR, tz1.getDSTSavings());
// an instance without daylight savings
tz1 = new Support_TimeZone(3 * ONE_HOUR, false);
assertEquals("T3. Incorrect daylight savings returned, ", 0, tz1.getDSTSavings());
}
Aggregations