Search in sources :

Example 16 with MutableInterval

use of org.joda.time.MutableInterval in project joda-time by JodaOrg.

the class TestStringConverter method testSetIntoInterval_Object_Chronology8.

public void testSetIntoInterval_Object_Chronology8() throws Exception {
    MutableInterval m = new MutableInterval(-1000L, 1000L);
    StringConverter.INSTANCE.setInto(m, "2003-08-09T+06:00/2004-06-09T+07:00", BuddhistChronology.getInstance(EIGHT));
    assertEquals(new DateTime(2003, 8, 9, 0, 0, 0, 0, BuddhistChronology.getInstance(SIX)).withZone(EIGHT), m.getStart());
    assertEquals(new DateTime(2004, 6, 9, 0, 0, 0, 0, BuddhistChronology.getInstance(SEVEN)).withZone(EIGHT), m.getEnd());
    assertEquals(BuddhistChronology.getInstance(EIGHT), m.getChronology());
}
Also used : MutableInterval(org.joda.time.MutableInterval) DateTime(org.joda.time.DateTime)

Example 17 with MutableInterval

use of org.joda.time.MutableInterval in project joda-time by JodaOrg.

the class TestStringConverter method testSetIntoInterval_Object_Chronology5.

public void testSetIntoInterval_Object_Chronology5() throws Exception {
    MutableInterval m = new MutableInterval(-1000L, 1000L);
    StringConverter.INSTANCE.setInto(m, "P1Y2M/2004-06-09T+06:00", null);
    assertEquals(new DateTime(2003, 4, 9, 0, 0, 0, 0, SIX).withChronology(null), m.getStart());
    assertEquals(new DateTime(2004, 6, 9, 0, 0, 0, 0, SIX).withChronology(null), m.getEnd());
    assertEquals(ISOChronology.getInstance(), m.getChronology());
}
Also used : MutableInterval(org.joda.time.MutableInterval) DateTime(org.joda.time.DateTime)

Example 18 with MutableInterval

use of org.joda.time.MutableInterval in project joda-time by JodaOrg.

the class TestStringConverter method testSetIntoInterval_Object_Chronology7.

public void testSetIntoInterval_Object_Chronology7() throws Exception {
    MutableInterval m = new MutableInterval(-1000L, 1000L);
    StringConverter.INSTANCE.setInto(m, "2003-08-09/2004-06-09", BuddhistChronology.getInstance());
    assertEquals(new DateTime(2003, 8, 9, 0, 0, 0, 0, BuddhistChronology.getInstance()), m.getStart());
    assertEquals(new DateTime(2004, 6, 9, 0, 0, 0, 0, BuddhistChronology.getInstance()), m.getEnd());
    assertEquals(BuddhistChronology.getInstance(), m.getChronology());
}
Also used : MutableInterval(org.joda.time.MutableInterval) DateTime(org.joda.time.DateTime)

Example 19 with MutableInterval

use of org.joda.time.MutableInterval in project joda-time by JodaOrg.

the class TestStringConverter method testSetIntoIntervalEx_Object_Chronology2.

public void testSetIntoIntervalEx_Object_Chronology2() throws Exception {
    MutableInterval m = new MutableInterval(-1000L, 1000L);
    try {
        StringConverter.INSTANCE.setInto(m, "/", null);
        fail();
    } catch (IllegalArgumentException ex) {
    }
}
Also used : MutableInterval(org.joda.time.MutableInterval)

Aggregations

MutableInterval (org.joda.time.MutableInterval)19 DateTime (org.joda.time.DateTime)8 Interval (org.joda.time.Interval)2 ReadableInterval (org.joda.time.ReadableInterval)2