Skip to content

Commit

Permalink
Create unit test for issue 130
Browse files Browse the repository at this point in the history
  • Loading branch information
mangstadt committed Mar 9, 2024
1 parent 5baf97e commit e0d486d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/test/java/biweekly/issues/Issue130.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package biweekly.issues;

import static biweekly.util.TestUtils.date;
import static org.junit.Assert.assertEquals;

import java.util.Date;
import java.util.TimeZone;

import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;

import biweekly.component.VEvent;
import biweekly.util.DefaultTimezoneRule;
import biweekly.util.Frequency;
import biweekly.util.Recurrence;
import biweekly.util.com.google.ical.compat.javautil.DateIterator;

/**
* @author Michael Angstadt
* @see "https://github.com/mangstadt/biweekly/issues/130"
*/
public class Issue130 {
@Rule
public final DefaultTimezoneRule rule = new DefaultTimezoneRule("America/Chicago");

@Test
@Ignore
public void test() throws Exception {
Date start = date(2024, 1, 1, 0, 0, 0);
Recurrence rrule = new Recurrence.Builder(Frequency.HOURLY).build();

VEvent event = new VEvent();
event.setDateStart(start);
event.setRecurrenceRule(rrule);

DateIterator it = event.getDateIterator(TimeZone.getDefault());
it.advanceTo(date(2024, 1, 31, 18, 0, 0));

Date actual = it.next(); //actual: "2024-02-01 00:00"
Date expected = date(2024, 1, 31, 19, 0, 0);

This comment has been minimized.

Copy link
@bstock21

bstock21 Jul 8, 2024

I believe this should actually be

Date expected = date(2024, 1, 31, 18, 0, 0);

assertEquals(expected, actual);
}
}

0 comments on commit e0d486d

Please sign in to comment.