Example #1
0
  public final void testParseDD_MMM_YYYY() throws ApplicationException {
    PMDate date;
    date = PMDateFormatter.parseDD_Mmm_YYYY("10-Jan-2004");
    assertEquals(10, date.getDate());
    assertEquals(1, date.getMonth());
    assertEquals(2004, date.getYear());

    date = PMDateFormatter.parseDD_Mmm_YYYY("1-Jan-2004");
    assertEquals(1, date.getDate());
    assertEquals(1, date.getMonth());
    assertEquals(2004, date.getYear());

    try {
      date = PMDateFormatter.parseDD_Mmm_YYYY("1Jan-2004");
      assertTrue(false);
    } catch (ApplicationException e) {
    }
  }
Example #2
0
  public final void testParseDD_MM_YYYY() throws ApplicationException {
    PMDate date = PMDateFormatter.parseDD_MM_YYYY("10/01/2004");
    assertEquals(10, date.getDate());
    assertEquals(1, date.getMonth());
    assertEquals(2004, date.getYear());

    try {
      date = PMDateFormatter.parseDD_MM_YYYY("2004a110");
      assertFalse(true);
    } catch (ApplicationException e) {
    }
  }
Example #3
0
  public final void testParseMMMspDD() throws ApplicationException {
    PMDate date;
    date = PMDateFormatter.parseMMMspDD("Mar 16");
    assertEquals(16, date.getDate());
    assertEquals(3, date.getMonth());
    assertEquals(Calendar.getInstance().get(Calendar.YEAR), date.getYear());

    date = PMDateFormatter.parseMMMspDD(" Apr 1");
    assertEquals(1, date.getDate());
    assertEquals(4, date.getMonth());
    assertEquals(Calendar.getInstance().get(Calendar.YEAR), date.getYear());

    date = PMDateFormatter.parseMMMspDD("Apr 1 2004");
    assertEquals(1, date.getDate());
    assertEquals(4, date.getMonth());
    assertEquals(2004, date.getYear());
    try {
      date = PMDateFormatter.parseMMMspDD("2004a110");
      assertFalse(true);
    } catch (ApplicationException e) {
    }
  }