Package com.agiletec.plugins.jpcalendar.aps.system.services.calendar.util

Examples of com.agiletec.plugins.jpcalendar.aps.system.services.calendar.util.DateEventInfo


public class TestDateEventInfo extends ApsPluginBaseTestCase {
 
  public void testIsValidEvent_MoveEnd_1() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    Calendar startEvent = Calendar.getInstance();
    startEvent.set(Calendar.YEAR, 1999);
    startEvent.set(Calendar.MONTH, Calendar.JANUARY);
    startEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setStart(startEvent.getTime());

    Calendar endEvent = Calendar.getInstance();
    endEvent.set(Calendar.YEAR, 1999);
    endEvent.set(Calendar.MONTH, Calendar.FEBRUARY);
    endEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setEnd(endEvent.getTime());

    assertFalse(info.isValidEvent());

    endEvent.set(Calendar.MONTH, Calendar.MAY);
    endEvent.set(Calendar.DAY_OF_MONTH, 1);
    info.setEnd(endEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(1, info.getEndDay());

    endEvent.set(Calendar.MONTH, Calendar.MAY);
    endEvent.set(Calendar.DAY_OF_MONTH, 8);
    info.setEnd(endEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(8, info.getEndDay());

    endEvent.set(Calendar.MONTH, Calendar.SEPTEMBER);
    endEvent.set(Calendar.DAY_OF_MONTH, 8);
    info.setEnd(endEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());

    endEvent.set(Calendar.MONTH, Calendar.JANUARY);
    endEvent.set(Calendar.DAY_OF_MONTH, 8);
    endEvent.set(Calendar.YEAR, 2000);
    info.setEnd(endEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());
  }
View Full Code Here


    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());
  }

  public void testIsValidEvent_MoveEnd_2() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.APRIL);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    Calendar startEvent = Calendar.getInstance();
    startEvent.set(Calendar.YEAR, 1999);
    startEvent.set(Calendar.MONTH, Calendar.APRIL);
    startEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setStart(startEvent.getTime());

    Calendar endEvent = Calendar.getInstance();
    endEvent.set(Calendar.YEAR, 1999);
    endEvent.set(Calendar.MONTH, Calendar.APRIL);
    endEvent.set(Calendar.DAY_OF_MONTH, 29);
    info.setEnd(endEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(12, info.getStartDay());
    assertEquals(29, info.getEndDay());

    endEvent.set(Calendar.MONTH, Calendar.APRIL);
    endEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setEnd(endEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(12, info.getStartDay());
    assertEquals(12, info.getEndDay());

    endEvent.set(Calendar.MONTH, Calendar.APRIL);
    endEvent.set(Calendar.DAY_OF_MONTH, 8);
    info.setEnd(endEvent.getTime());

    assertFalse(info.isValidEvent());

    endEvent.set(Calendar.MONTH, Calendar.JANUARY);
    endEvent.set(Calendar.DAY_OF_MONTH, 8);
    info.setEnd(endEvent.getTime());

    assertFalse(info.isValidEvent());

  }
View Full Code Here

  }

  public void testIsValidEvent_NullEnd_2() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    Calendar startEvent = Calendar.getInstance();
    startEvent.set(Calendar.YEAR, 1999);
    startEvent.set(Calendar.MONTH, Calendar.JANUARY);
    startEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setStart(startEvent.getTime());

    info.setEnd(null);
    assertFalse(info.isValidEvent());
  }
View Full Code Here

    assertFalse(info.isValidEvent());
  }

  public void testIsValidEvent_NullEnd_3() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    Calendar startEvent = Calendar.getInstance();
    startEvent.set(Calendar.YEAR, 1999);
    startEvent.set(Calendar.MONTH, Calendar.MAY);
    startEvent.set(Calendar.DAY_OF_MONTH, 1);
    info.setStart(startEvent.getTime());

    info.setEnd(null);
    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(1, info.getEndDay());
  }
View Full Code Here

    assertEquals(1, info.getEndDay());
  }

  public void testIsValidEvent_NullEnd_4() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    Calendar startEvent = Calendar.getInstance();
    startEvent.set(Calendar.YEAR, 1999);
    startEvent.set(Calendar.MONTH, Calendar.MAY);
    startEvent.set(Calendar.DAY_OF_MONTH, startEvent.getActualMaximum(Calendar.DAY_OF_MONTH));
    info.setStart(startEvent.getTime());

    info.setEnd(null);
    assertTrue(info.isValidEvent());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());
  }
View Full Code Here

    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());
  }

  public void testIsValidEvent_NullEnd_5() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    Calendar startEvent = Calendar.getInstance();
    startEvent.set(Calendar.YEAR, 1999);
    startEvent.set(Calendar.MONTH, Calendar.SEPTEMBER);
    startEvent.set(Calendar.DAY_OF_MONTH, 25);
    info.setStart(startEvent.getTime());

    info.setEnd(null);
    assertFalse(info.isValidEvent());
  }
View Full Code Here

    assertFalse(info.isValidEvent());
  }

  public void testIsValidEvent_MoveStart_6() {
    Calendar requiredMonth = this.getRequiredMonth(1998, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    Calendar startEvent = Calendar.getInstance();
    startEvent.set(Calendar.YEAR, 1999);
    startEvent.set(Calendar.MONTH, Calendar.JANUARY);
    startEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setStart(startEvent.getTime());

    Calendar endEvent = Calendar.getInstance();
    endEvent.set(Calendar.YEAR, 1999);
    endEvent.set(Calendar.MONTH, Calendar.FEBRUARY);
    endEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setEnd(endEvent.getTime());

    assertFalse(info.isValidEvent());

    startEvent.set(Calendar.YEAR, 1998);
    startEvent.set(Calendar.MONTH, Calendar.JUNE);
    startEvent.set(Calendar.DAY_OF_MONTH, 1);
    info.setStart(startEvent.getTime());

    assertFalse(info.isValidEvent());

    startEvent.set(Calendar.YEAR, 1998);
    startEvent.set(Calendar.MONTH, Calendar.MAY);
    startEvent.set(Calendar.DAY_OF_MONTH, startEvent.getActualMaximum(Calendar.DAY_OF_MONTH));
    info.setStart(startEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());

    startEvent.set(Calendar.YEAR, 1998);
    startEvent.set(Calendar.MONTH, Calendar.MAY);
    startEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setStart(startEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(12, info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());

    startEvent.set(Calendar.YEAR, 1998);
    startEvent.set(Calendar.MONTH, Calendar.MAY);
    startEvent.set(Calendar.DAY_OF_MONTH, 1);
    info.setStart(startEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());

    startEvent.set(Calendar.YEAR, 1998);
    startEvent.set(Calendar.MONTH, Calendar.APRIL);
    startEvent.set(Calendar.DAY_OF_MONTH, startEvent.getActualMaximum(Calendar.DAY_OF_MONTH));
    info.setStart(startEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());

    startEvent.set(Calendar.YEAR, 1997);
    startEvent.set(Calendar.MONTH, Calendar.SEPTEMBER);
    startEvent.set(Calendar.DAY_OF_MONTH, 23);
    info.setStart(startEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());
  }
View Full Code Here

    assertEquals(requiredMonth.getActualMaximum(Calendar.DAY_OF_MONTH), info.getEndDay());
  }

  public void testIsValidEvent_NullStart_7() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    info.setStart(null);

    Calendar endEvent = Calendar.getInstance();
    endEvent.set(Calendar.YEAR, 1999);
    endEvent.set(Calendar.MONTH, Calendar.JANUARY);
    endEvent.set(Calendar.DAY_OF_MONTH, 12);
    info.setEnd(endEvent.getTime());

    assertFalse(info.isValidEvent());
  }
View Full Code Here

    assertFalse(info.isValidEvent());
  }
 
  public void testIsValidEvent_NullStart_8() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    info.setStart(null);
   
    Calendar endEvent = Calendar.getInstance();
    endEvent.set(Calendar.DAY_OF_MONTH, endEvent.getActualMinimum(Calendar.DAY_OF_MONTH));
    endEvent.set(Calendar.YEAR, 1999);
    endEvent.set(Calendar.MONTH, Calendar.APRIL);
    endEvent.set(Calendar.DAY_OF_MONTH, endEvent.getActualMaximum(Calendar.DAY_OF_MONTH));
    info.setEnd(endEvent.getTime());

    assertFalse(info.isValidEvent());
  }
View Full Code Here

    assertFalse(info.isValidEvent());
  }
 
  public void testIsValidEvent_NullStart_9() {
    Calendar requiredMonth = this.getRequiredMonth(1999, Calendar.MAY);
    DateEventInfo info = this.getDateEventInfoForTest(requiredMonth);

    info.setStart(null);

    Calendar endEvent = Calendar.getInstance();
    endEvent.set(Calendar.YEAR, 1999);
    endEvent.set(Calendar.MONTH, Calendar.MAY);
    endEvent.set(Calendar.DAY_OF_MONTH, 1);
    info.setEnd(endEvent.getTime());

    assertTrue(info.isValidEvent());
    assertEquals(1, info.getStartDay());
    assertEquals(1, info.getEndDay());
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpcalendar.aps.system.services.calendar.util.DateEventInfo

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.