public void test_getType() { BaseDateTimeField field = new MockPreciseDurationDateTimeField( DateTimeFieldType.secondOfDay(), new MockCountingDurationField(DurationFieldType.minutes())); assertEquals(DateTimeFieldType.secondOfDay(), field.getType()); }
// ----------------------------------------------------------------------- public void test_constructor() { BaseDateTimeField field = new MockPreciseDurationDateTimeField(); assertEquals(DateTimeFieldType.secondOfMinute(), field.getType()); try { field = new MockPreciseDurationDateTimeField(null, null); fail(); } catch (IllegalArgumentException ex) { } try { field = new MockPreciseDurationDateTimeField( DateTimeFieldType.minuteOfHour(), new MockImpreciseDurationField(DurationFieldType.minutes())); fail(); } catch (IllegalArgumentException ex) { } try { field = new MockPreciseDurationDateTimeField( DateTimeFieldType.minuteOfHour(), new MockZeroDurationField(DurationFieldType.minutes())); fail(); } catch (IllegalArgumentException ex) { } }
public void test_toString() { BaseDateTimeField field = new MockPreciseDurationDateTimeField( DateTimeFieldType.secondOfDay(), new MockCountingDurationField(DurationFieldType.minutes())); assertEquals("DateTimeField[secondOfDay]", field.toString()); }
/** * Restricted constructor. * * @param leapMonth the month of year that leaps */ BasicMonthOfYearDateTimeField(BasicChronology chronology, int leapMonth) { super(DateTimeFieldType.monthOfYear(), chronology.getAverageMillisPerMonth()); iChronology = chronology; iMax = iChronology.getMaxMonth(); iLeapMonth = leapMonth; }
protected MockPreciseDurationDateTimeField() { super( DateTimeFieldType.secondOfMinute(), new MockCountingDurationField(DurationFieldType.seconds())); }
/** * Constructor. * * @param type the field type * @param unitMillis the average duration unit milliseconds */ public ImpreciseDateTimeField(DateTimeFieldType type, long unitMillis) { super(type); iUnitMillis = unitMillis; iDurationField = new LinkedDurationField(type.getDurationType()); }
/** * Restricted constructor. * * @param chronology the chronology this field belogs to */ BasicYearDateTimeField(BasicChronology chronology) { super(DateTimeFieldType.year(), chronology.getAverageMillisPerYear()); iChronology = chronology; }