use of java.util.SimpleTimeZone in project j2objc by google.
the class SimpleTimeZoneTest method test_equalsLjava_lang_Object.
/**
* java.util.SimpleTimeZone#equals(java.lang.Object)
*/
public void test_equalsLjava_lang_Object() {
// Test for method boolean
// java.util.SimpleTimeZone.equals(java.lang.Object)
TimeZone tz = TimeZone.getTimeZone("EST");
st1 = new SimpleTimeZone(tz.getRawOffset(), "EST");
st2 = new SimpleTimeZone(0, "EST");
assertFalse(st1.equals(st2));
st1.setRawOffset(st2.getRawOffset());
assertTrue(st1.equals(st2));
}
use of java.util.SimpleTimeZone in project j2objc by google.
the class SimpleTimeZoneTest method test_ConstructorILjava_lang_StringIIIIIIIIIII.
/**
* java.util.SimpleTimeZone#SimpleTimeZone(int, java.lang.String,
* int, int, int, int, int, int, int, int, int, int, int)
*/
public void test_ConstructorILjava_lang_StringIIIIIIIIIII() {
// Test for method java.util.SimpleTimeZone(int, java.lang.String, int,
// int, int, int, int, int, int, int, int, int, int)
// TODO : Implement test
//Regression for HARMONY-1241
assertNotNull(new SimpleTimeZone(TimeZone.LONG, "Europe/Paris", SimpleTimeZone.STANDARD_TIME, SimpleTimeZone.STANDARD_TIME, SimpleTimeZone.UTC_TIME, SimpleTimeZone.WALL_TIME, SimpleTimeZone.WALL_TIME, TimeZone.SHORT, SimpleTimeZone.STANDARD_TIME, TimeZone.LONG, SimpleTimeZone.UTC_TIME, SimpleTimeZone.STANDARD_TIME, TimeZone.LONG));
//seems RI doesn't check the startTimeMode and endTimeMode at all
//this behavior is contradicts with spec
assertNotNull(new SimpleTimeZone(TimeZone.LONG, "Europe/Paris", SimpleTimeZone.STANDARD_TIME, SimpleTimeZone.STANDARD_TIME, SimpleTimeZone.UTC_TIME, SimpleTimeZone.WALL_TIME, Integer.MAX_VALUE, TimeZone.SHORT, SimpleTimeZone.STANDARD_TIME, TimeZone.LONG, SimpleTimeZone.UTC_TIME, Integer.MIN_VALUE, TimeZone.LONG));
try {
new SimpleTimeZone(1000, "TEST", 12, 1, Calendar.SUNDAY, 0, Integer.MAX_VALUE, Calendar.NOVEMBER, -1, Calendar.SUNDAY, 0, Integer.MAX_VALUE, 1000 * 60 * 60);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
//expected
}
try {
new SimpleTimeZone(1000, "TEST", Calendar.NOVEMBER, 10, Calendar.SUNDAY, 0, Integer.MAX_VALUE, Calendar.NOVEMBER, -1, Calendar.SUNDAY, 0, Integer.MAX_VALUE, 1000 * 60 * 60);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
//expected
}
try {
new SimpleTimeZone(1000, "TEST", Calendar.NOVEMBER, 1, 10, 0, Calendar.NOVEMBER, Integer.MAX_VALUE, -1, Calendar.SUNDAY, 0, Integer.MAX_VALUE, 1000 * 60 * 60);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
//expected
}
try {
new SimpleTimeZone(1000, "TEST", Calendar.DECEMBER, 1, Calendar.SUNDAY, 0, Calendar.NOVEMBER, Integer.MAX_VALUE, -10, Calendar.SUNDAY, 0, Integer.MAX_VALUE, 1000 * 60 * 60);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
//expected
}
}
use of java.util.SimpleTimeZone in project j2objc by google.
the class GregorianCalendarTest method test_computeTime_enteringDst.
public void test_computeTime_enteringDst() {
// Get the DST entry time with a ZoneInfo implementation of TimeZone.
TimeZone zoneInfo = TimeZone.getTimeZone("America/Los_Angeles");
long zoneInfoTime = getDstLosAngeles2014(zoneInfo);
// Check that the time is correct.
assertTrue(zoneInfo.inDaylightTime(new Date(zoneInfoTime)));
assertFalse(zoneInfo.inDaylightTime(new Date(zoneInfoTime - 1)));
// Get the DST entry time with a SimpleTimeZone implementation of TimeZone.
SimpleTimeZone simpleTimeZone = new SimpleTimeZone(-28800000, "Custom America/Los_Angeles", Calendar.MARCH, 9, 0, 7200000, Calendar.NOVEMBER, 2, 0, 7200000, 3600000);
long simpleTimeZoneTime = getDstLosAngeles2014(simpleTimeZone);
}
use of java.util.SimpleTimeZone in project j2objc by google.
the class SimpleTimeZoneTest method testDstNewYork2014_9thMarch_2ndNovember_DefaultTime.
public void testDstNewYork2014_9thMarch_2ndNovember_DefaultTime() {
TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST", Calendar.MARCH, 9, 0, 7200000, Calendar.NOVEMBER, 2, 0, 7200000, 3600000);
checkDstNewYork2014(timeZone);
}
use of java.util.SimpleTimeZone in project j2objc by google.
the class SimpleTimeZoneTest method testDstNewYork2014_2ndSundayMarch_1stSundayNovember_UtcTime.
public void testDstNewYork2014_2ndSundayMarch_1stSundayNovember_UtcTime() {
TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST", Calendar.MARCH, 2, Calendar.SUNDAY, 25200000, SimpleTimeZone.UTC_TIME, Calendar.NOVEMBER, 1, Calendar.SUNDAY, 21600000, SimpleTimeZone.UTC_TIME, 3600000);
checkDstNewYork2014(timeZone);
}
Aggregations