Search in sources :

Example 6 with MutableInterval

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

the class TestStringConverter method testSetIntoIntervalEx_Object_Chronology5.

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

Example 7 with MutableInterval

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

the class TestStringConverter method testSetIntoInterval_Object_Chronology6.

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

Example 8 with MutableInterval

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

the class TestStringConverter method testSetIntoIntervalEx_Object_Chronology1.

public void testSetIntoIntervalEx_Object_Chronology1() 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)

Example 9 with MutableInterval

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

the class TestReadableIntervalConverter method testSetIntoInterval_Object1.

public void testSetIntoInterval_Object1() throws Exception {
    Interval i = new Interval(0L, 123L, CopticChronology.getInstance());
    MutableInterval m = new MutableInterval(-1000L, 1000L, BuddhistChronology.getInstance());
    ReadableIntervalConverter.INSTANCE.setInto(m, i, null);
    assertEquals(0L, m.getStartMillis());
    assertEquals(123L, m.getEndMillis());
    assertEquals(CopticChronology.getInstance(), m.getChronology());
}
Also used : MutableInterval(org.joda.time.MutableInterval) ReadableInterval(org.joda.time.ReadableInterval) Interval(org.joda.time.Interval) MutableInterval(org.joda.time.MutableInterval)

Example 10 with MutableInterval

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

the class TestStringConverter method testSetIntoInterval_Object_Chronology3.

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

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