Search in sources :

Example 66 with SimpleTimeZone

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));
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 67 with SimpleTimeZone

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
    }
}
Also used : SimpleTimeZone(java.util.SimpleTimeZone)

Example 68 with SimpleTimeZone

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);
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone) Date(java.util.Date)

Example 69 with 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);
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 70 with SimpleTimeZone

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);
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Aggregations

SimpleTimeZone (java.util.SimpleTimeZone)114 TimeZone (java.util.TimeZone)42 GregorianCalendar (java.util.GregorianCalendar)34 Date (java.util.Date)25 SimpleDateFormat (java.text.SimpleDateFormat)20 Calendar (java.util.Calendar)8 Test (org.junit.Test)7 BasicDBObject (com.mongodb.BasicDBObject)3 BSONTimestamp (org.bson.types.BSONTimestamp)3 Code (org.bson.types.Code)3 CodeWScope (org.bson.types.CodeWScope)3 ObjectId (org.bson.types.ObjectId)3 Support_TimeZone (tests.support.Support_TimeZone)3 DBRef (com.mongodb.DBRef)2 IOException (java.io.IOException)2 InvalidObjectException (java.io.InvalidObjectException)2 DateFormat (java.text.DateFormat)2 ParsePosition (java.text.ParsePosition)2 Binary (org.bson.types.Binary)2 MaxKey (org.bson.types.MaxKey)2