Search in sources :

Example 56 with GregorianCalendar

use of java.util.GregorianCalendar in project j2objc by google.

the class DateTest method test_ConstructorIII.

/**
     * java.util.Date#Date(int, int, int)
     */
public void test_ConstructorIII() {
    // Test for method java.util.Date(int, int, int)
    // the epoch + local time
    Date d1 = new Date(70, 0, 1);
    // the epoch + local time
    Date d2 = new Date(0 + d1.getTimezoneOffset() * 60 * 1000);
    assertTrue("Created incorrect date", d1.equals(d2));
    Date date = new Date(99, 5, 22);
    Calendar cal = new GregorianCalendar(1999, Calendar.JUNE, 22);
    assertTrue("Wrong time zone", date.equals(cal.getTime()));
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Example 57 with GregorianCalendar

use of java.util.GregorianCalendar in project j2objc by google.

the class DateTest method test_setDateI.

/**
     * java.util.Date#setDate(int)
     */
public void test_setDateI() {
    // Test for method void java.util.Date.setDate(int)
    Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9).getTime();
    d.setDate(23);
    assertEquals("Set incorrect date", 23, d.getDate());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Example 58 with GregorianCalendar

use of java.util.GregorianCalendar in project j2objc by google.

the class DateTest method test_getYear.

/**
     * java.util.Date#getYear()
     */
public void test_getYear() {
    // Test for method int java.util.Date.getYear()
    Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9).getTime();
    assertEquals("Returned incorrect year", 98, d.getYear());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Example 59 with GregorianCalendar

use of java.util.GregorianCalendar in project j2objc by google.

the class DateTest method test_setYearI.

/**
     * java.util.Date#setYear(int)
     */
public void test_setYearI() {
    // Test for method void java.util.Date.setYear(int)
    Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9).getTime();
    d.setYear(8);
    assertEquals("Set incorrect year", 8, d.getYear());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Example 60 with GregorianCalendar

use of java.util.GregorianCalendar in project j2objc by google.

the class DateTest method test_setMinutesI.

/**
     * java.util.Date#setMinutes(int)
     */
public void test_setMinutesI() {
    // Test for method void java.util.Date.setMinutes(int)
    Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9).getTime();
    d.setMinutes(45);
    assertEquals("Set incorrect mins", 45, d.getMinutes());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Aggregations

GregorianCalendar (java.util.GregorianCalendar)1278 Calendar (java.util.Calendar)603 Date (java.util.Date)377 Test (org.junit.Test)247 SimpleDateFormat (java.text.SimpleDateFormat)104 Timestamp (java.sql.Timestamp)54 ScheduleExpression (javax.ejb.ScheduleExpression)51 ArrayList (java.util.ArrayList)48 EJBCronTrigger (org.apache.openejb.core.timer.EJBCronTrigger)42 HashMap (java.util.HashMap)41 ParseException (java.text.ParseException)39 TimeZone (java.util.TimeZone)38 SimpleTimeZone (java.util.SimpleTimeZone)35 BigDecimal (java.math.BigDecimal)32 Date (java.sql.Date)30 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)28 SQLException (java.sql.SQLException)20 DateFormat (java.text.DateFormat)18 IOException (java.io.IOException)16 Map (java.util.Map)16