Package com.mdimension.jchronic.repeaters

Examples of com.mdimension.jchronic.repeaters.RepeaterMonthName


    super.setUp();
    _now = Time.construct(2006, 8, 16, 14, 0, 0, 0);
  }

  public void testNext() {
    RepeaterMonthName mays = new RepeaterMonthName(RepeaterMonthName.MonthName.MAY);
    mays.setStart(_now);
   
    Span nextMay = mays.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2007, 5), nextMay.getBeginCalendar());
    assertEquals(Time.construct(2007, 6), nextMay.getEndCalendar());

    Span nextNextMay = mays.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2008, 5), nextNextMay.getBeginCalendar());
    assertEquals(Time.construct(2008, 6), nextNextMay.getEndCalendar());

    RepeaterMonthName decembers = new RepeaterMonthName(RepeaterMonthName.MonthName.DECEMBER);
    decembers.setStart(_now);
   
    Span nextDecember = decembers.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 12), nextDecember.getBeginCalendar());
    assertEquals(Time.construct(2007, 1), nextDecember.getEndCalendar());

    mays = new RepeaterMonthName(RepeaterMonthName.MonthName.MAY);
    mays.setStart(_now);
   
    assertEquals(Time.construct(2006, 5), mays.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
    assertEquals(Time.construct(2005, 5), mays.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
  }
View Full Code Here


    assertEquals(Time.construct(2006, 5), mays.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
    assertEquals(Time.construct(2005, 5), mays.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
  }

  public void testThis() {
    RepeaterMonthName octobers = new RepeaterMonthName(RepeaterMonthName.MonthName.MAY);
    octobers.setStart(_now);
   
    Span nextMay = octobers.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2007, 5), nextMay.getBeginCalendar());
    assertEquals(Time.construct(2007, 6), nextMay.getEndCalendar());

    Span nextNextMay = octobers.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2008, 5), nextNextMay.getBeginCalendar());
    assertEquals(Time.construct(2008, 6), nextNextMay.getEndCalendar());
  }
View Full Code Here

  public void testHandlerClass4() {
    Handler handler = new Handler(new DummyHandler(), new TagPattern(RepeaterMonthName.class), new TagPattern(ScalarDay.class), new HandlerTypePattern(Handler.HandlerType.TIME, true));
    List<Token> tokens = new LinkedList<Token>();
    tokens.add(new Token("may"));
    tokens.get(0).tag(new RepeaterMonthName(RepeaterMonthName.MonthName.MAY));
   
    assertFalse(handler.match(tokens, Handler.definitions()));
   
    tokens.add(new Token("27"));
    tokens.get(1).tag(new ScalarDay(Integer.valueOf(27)));
View Full Code Here

TOP

Related Classes of com.mdimension.jchronic.repeaters.RepeaterMonthName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.