pnreddysvu / google-rfc-2445

Automatically exported from code.google.com/p/google-rfc-2445
Apache License 2.0
0 stars 0 forks source link

RecurrenceIteratorFactory.except doesn't honor its contract #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A simple JUnit test is needed to reproduce the bug.

public void testExcept() throws Exception 
{
  RecurrenceIterator rrule 
         = RecurrenceIteratorFactory
                  .createRecurrenceIterator(
                                  "RRULE:FREQ=WEEKLY;INTERVAL=3;COUNT=5",
                                  new DateValueImpl(2009, 02, 02), 
                                  GMT1);
  StringBuilder sb = createRecuranceDateString(rrule);

  // test succeed
  assertEquals("20090202,20090223,20090316,20090406,20090427", 
                                   sb.toString());

  RecurrenceIterator rdate 
         = RecurrenceIteratorFactory
                  .createRecurrenceIterator(
                                  "RDATE;VALUE=DATE:20090316", 
                                  new DateValueImpl(2009, 03, 16), 
                                  GMT1);

  sb = createRecuranceDateString(rdate);

  //test succeed
  assertEquals("20090316", sb.toString());

  RecurrenceIterator rdateExcept 
                = RecurrenceIteratorFactory.except(rrule, rdate);

  sb = createRecuranceDateString(rdateExcept);

  //test FAILED !! 
  assertEquals("20090202,20090223,20090406,20090427", sb.toString());
}

The last assert returns: 
   junit.framework.ComparisonFailure: 
      expected:<20090202,20090223,20090406,20090427> 
      but was:<>

Thanks for this excellent project,

Regards

Yanick.

Original issue reported on code.google.com by yani...@gmail.com on 18 Feb 2009 at 11:15