Search in sources :

Example 11 with MutableInterval

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

the class TestStringConverter method testSetIntoIntervalEx_Object_Chronology4.

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

Example 12 with MutableInterval

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

the class TestNullConverter method testSetInto_Object_Chronology2.

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

Example 13 with MutableInterval

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

the class TestReadableIntervalConverter method testSetIntoInterval_Object4.

public void testSetIntoInterval_Object4() 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, null);
    assertEquals(0L, m.getStartMillis());
    assertEquals(123L, m.getEndMillis());
    assertEquals(ISOChronology.getInstance(), m.getChronology());
}
Also used : MutableInterval(org.joda.time.MutableInterval)

Example 14 with MutableInterval

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

the class TestStringConverter method testSetIntoInterval_Object_Chronology2.

public void testSetIntoInterval_Object_Chronology2() throws Exception {
    MutableInterval m = new MutableInterval(-1000L, 1000L);
    StringConverter.INSTANCE.setInto(m, "P1Y2M/2004-06-09", null);
    assertEquals(new DateTime(2003, 4, 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)

Example 15 with MutableInterval

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

the class TestStringConverter method testSetIntoInterval_Object_Chronology1.

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