示例#1
0
 @Test
 public void testIndeterminateNowStart() {
   TimePeriod timePeriod = new TimePeriod(null, TimeIndeterminateValue.now, new DateTime(), null);
   DateTime beforeAccess = new DateTime();
   DateTime nowValue = timePeriod.resolveStart();
   assertNotNull("TimePeriod start now value is null", nowValue);
   assertTrue(
       "TimePeriod start now value is too early",
       nowValue.isAfter(beforeAccess) || nowValue.isEqual(beforeAccess));
   assertTrue(
       "TimePeriod start now value is too late", nowValue.isBeforeNow() || nowValue.isEqualNow());
 }
示例#2
0
  public boolean isOnCurrentPeriod() {
    boolean isOnCurrentPeriod = false;

    if (getCalendarEntry() != null) {
      DateTime beginPeriodDateTime = getCalendarEntry().getBeginPeriodFullDateTime();
      DateTime endPeriodDateTime = getCalendarEntry().getEndPeriodFullDateTime();
      isOnCurrentPeriod =
          (beginPeriodDateTime.isEqualNow() || beginPeriodDateTime.isBeforeNow())
              && endPeriodDateTime.isAfterNow();
    }

    return isOnCurrentPeriod;
  }