Search in sources :

Example 11 with MutablePeriod

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

the class TestReadablePeriodConverter method testSetInto_Object.

public void testSetInto_Object() throws Exception {
    MutablePeriod m = new MutablePeriod(PeriodType.yearMonthDayTime());
    ReadablePeriodConverter.INSTANCE.setInto(m, new Period(0, 0, 0, 3, 0, 4, 0, 5), null);
    assertEquals(0, m.getYears());
    assertEquals(0, m.getMonths());
    assertEquals(0, m.getWeeks());
    assertEquals(3, m.getDays());
    assertEquals(0, m.getHours());
    assertEquals(4, m.getMinutes());
    assertEquals(0, m.getSeconds());
    assertEquals(5, m.getMillis());
}
Also used : Period(org.joda.time.Period) MutablePeriod(org.joda.time.MutablePeriod) ReadablePeriod(org.joda.time.ReadablePeriod) MutablePeriod(org.joda.time.MutablePeriod)

Example 12 with MutablePeriod

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

the class TestStringConverter method testSetIntoPeriod_Object5.

public void testSetIntoPeriod_Object5() throws Exception {
    MutablePeriod m = new MutablePeriod(PeriodType.yearWeekDayTime());
    StringConverter.INSTANCE.setInto(m, "P2Y4W3DT12H24M56.S", null);
    assertEquals(2, m.getYears());
    assertEquals(4, m.getWeeks());
    assertEquals(3, m.getDays());
    assertEquals(12, m.getHours());
    assertEquals(24, m.getMinutes());
    assertEquals(56, m.getSeconds());
    assertEquals(0, m.getMillis());
}
Also used : MutablePeriod(org.joda.time.MutablePeriod)

Example 13 with MutablePeriod

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

the class TestNullConverter method testSetInto_Object.

public void testSetInto_Object() throws Exception {
    MutablePeriod m = new MutablePeriod(PeriodType.millis());
    NullConverter.INSTANCE.setInto(m, null, null);
    assertEquals(0L, m.getMillis());
}
Also used : MutablePeriod(org.joda.time.MutablePeriod)

Example 14 with MutablePeriod

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

the class TestStringConverter method testSetIntoPeriod_Object7.

public void testSetIntoPeriod_Object7() throws Exception {
    MutablePeriod m = new MutablePeriod(1, 0, 1, 1, 1, 1, 1, 1, PeriodType.yearWeekDayTime());
    StringConverter.INSTANCE.setInto(m, "P2Y4W3D", null);
    assertEquals(2, m.getYears());
    assertEquals(4, m.getWeeks());
    assertEquals(3, m.getDays());
    assertEquals(0, m.getHours());
    assertEquals(0, m.getMinutes());
    assertEquals(0, m.getSeconds());
    assertEquals(0, m.getMillis());
}
Also used : MutablePeriod(org.joda.time.MutablePeriod)

Example 15 with MutablePeriod

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

the class TestStringConverter method testSetIntoPeriod_Object2.

public void testSetIntoPeriod_Object2() throws Exception {
    MutablePeriod m = new MutablePeriod(PeriodType.yearWeekDayTime());
    StringConverter.INSTANCE.setInto(m, "P2Y4W3DT12H24M48S", null);
    assertEquals(2, m.getYears());
    assertEquals(4, m.getWeeks());
    assertEquals(3, m.getDays());
    assertEquals(12, m.getHours());
    assertEquals(24, m.getMinutes());
    assertEquals(48, m.getSeconds());
    assertEquals(0, m.getMillis());
}
Also used : MutablePeriod(org.joda.time.MutablePeriod)

Aggregations

MutablePeriod (org.joda.time.MutablePeriod)17 Interval (org.joda.time.Interval)2 MutableInterval (org.joda.time.MutableInterval)2 ReadableInterval (org.joda.time.ReadableInterval)2 Duration (org.joda.time.Duration)1 Period (org.joda.time.Period)1 ReadableDuration (org.joda.time.ReadableDuration)1 ReadablePeriod (org.joda.time.ReadablePeriod)1