use of org.joda.time.MutablePeriod in project joda-time by JodaOrg.
the class TestPeriodFormatter method testParseInto_simple.
//-----------------------------------------------------------------------
public void testParseInto_simple() {
MutablePeriod expect = new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8);
MutablePeriod result = new MutablePeriod();
assertEquals(20, f.parseInto(result, "P1Y2M3W4DT5H6M7.008S", 0));
assertEquals(expect, result);
try {
f.parseInto(null, "P1Y2M3W4DT5H6M7.008S", 0);
fail();
} catch (IllegalArgumentException ex) {
}
assertEquals(~0, f.parseInto(result, "ABC", 0));
}
use of org.joda.time.MutablePeriod in project joda-time by JodaOrg.
the class BaseSingleFieldPeriod method toMutablePeriod.
/**
* Get this object as a <code>MutablePeriod</code>.
* <p>
* This will always return a new <code>MutablePeriod</code> with the same fields.
* The period will use <code>PeriodType.standard()</code>.
*
* @return a MutablePeriod using the same field set and values
*/
public MutablePeriod toMutablePeriod() {
MutablePeriod period = new MutablePeriod();
period.add(this);
return period;
}
Aggregations