Search in sources :

Example 1 with MutableInterval

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

the class TestNullConverter method testSetInto_Object_Chronology1.

public void testSetInto_Object_Chronology1() throws Exception {
    MutableInterval m = new MutableInterval(1000L, 2000L, GJChronology.getInstance());
    NullConverter.INSTANCE.setInto(m, null, null);
    assertEquals(TEST_TIME_NOW, m.getStartMillis());
    assertEquals(TEST_TIME_NOW, m.getEndMillis());
    assertEquals(ISOChronology.getInstance(), m.getChronology());
}
Also used : MutableInterval(org.joda.time.MutableInterval)

Example 2 with MutableInterval

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

the class TestReadableIntervalConverter method testSetIntoInterval_Object3.

public void testSetIntoInterval_Object3() throws Exception {
    MutableInterval i = new MutableInterval(0L, 123L) {

        public Chronology getChronology() {
            // bad
            return null;
        }
    };
    MutableInterval m = new MutableInterval(-1000L, 1000L, BuddhistChronology.getInstance());
    ReadableIntervalConverter.INSTANCE.setInto(m, i, GJChronology.getInstance());
    assertEquals(0L, m.getStartMillis());
    assertEquals(123L, m.getEndMillis());
    assertEquals(GJChronology.getInstance(), m.getChronology());
}
Also used : MutableInterval(org.joda.time.MutableInterval)

Example 3 with MutableInterval

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

the class TestReadableIntervalConverter method testSetIntoInterval_Object2.

public void testSetIntoInterval_Object2() throws Exception {
    Interval i = new Interval(0L, 123L, CopticChronology.getInstance());
    MutableInterval m = new MutableInterval(-1000L, 1000L, BuddhistChronology.getInstance());
    ReadableIntervalConverter.INSTANCE.setInto(m, i, GJChronology.getInstance());
    assertEquals(0L, m.getStartMillis());
    assertEquals(123L, m.getEndMillis());
    assertEquals(GJChronology.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 4 with MutableInterval

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

the class TestStringConverter method testSetIntoInterval_Object_Chronology4.

public void testSetIntoInterval_Object_Chronology4() throws Exception {
    MutableInterval m = new MutableInterval(-1000L, 1000L);
    StringConverter.INSTANCE.setInto(m, "2004-06-09T+06:00/P1Y2M", null);
    assertEquals(new DateTime(2004, 6, 9, 0, 0, 0, 0, SIX).withChronology(null), m.getStart());
    assertEquals(new DateTime(2005, 8, 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 5 with MutableInterval

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

the class TestStringConverter method testSetIntoIntervalEx_Object_Chronology3.

public void testSetIntoIntervalEx_Object_Chronology3() throws Exception {
    MutableInterval m = new MutableInterval(-1000L, 1000L);
    try {
        StringConverter.INSTANCE.setInto(m, "P1Y/", 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