-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,254 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package biweekly.issues; | ||
|
||
import static biweekly.util.TestUtils.date; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.util.Date; | ||
|
||
import org.junit.Test; | ||
|
||
import biweekly.Biweekly; | ||
import biweekly.ICalendar; | ||
import biweekly.component.VEvent; | ||
|
||
/** | ||
* @author Michael Angstadt | ||
* @see "https://github.com/mangstadt/biweekly/issues/115" | ||
*/ | ||
public class Issue115 { | ||
@Test | ||
public void test1() throws Exception { | ||
ICalendar ical = Biweekly.parse(getClass().getResourceAsStream("issue115-1.ics")).first(); | ||
|
||
/* | ||
* The event comes before the last Sunday in October, so it should | ||
* be in daylight time (offset of +02:00). | ||
*/ | ||
VEvent event = ical.getEvents().get(0); | ||
|
||
Date expected = date(2022, 10, 29, 8, 0, 0, "+0200"); | ||
Date actual = event.getDateStart().getValue(); | ||
assertEquals(expected, actual); | ||
|
||
expected = date(2022, 10, 29, 8, 30, 0, "+0200"); | ||
actual = event.getDateEnd().getValue(); | ||
assertEquals(expected, actual); | ||
} | ||
|
||
@Test | ||
public void test2() throws Exception { | ||
ICalendar ical = Biweekly.parse(getClass().getResourceAsStream("issue115-2.ics")).first(); | ||
|
||
/* | ||
* The event comes after the last Sunday in October, so it should | ||
* be in standard time (offset of +01:00). | ||
*/ | ||
VEvent event = ical.getEvents().get(0); | ||
|
||
Date expected = date(2022, 10, 31, 8, 0, 0, "+0100"); | ||
System.out.println(expected); | ||
Date actual = event.getDateStart().getValue(); | ||
assertEquals(expected, actual); | ||
|
||
expected = date(2022, 10, 31, 8, 30, 0, "+0100"); | ||
actual = event.getDateEnd().getValue(); | ||
assertEquals(expected, actual); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package biweekly.issues; | ||
|
||
import static biweekly.util.TestUtils.date; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.util.Date; | ||
|
||
import org.junit.Test; | ||
|
||
import biweekly.Biweekly; | ||
import biweekly.ICalendar; | ||
import biweekly.component.VEvent; | ||
|
||
/** | ||
* @author Michael Angstadt | ||
* @see "https://github.com/mangstadt/biweekly/issues/126" | ||
*/ | ||
public class Issue126 { | ||
@Test | ||
public void test() throws Exception { | ||
ICalendar ical = Biweekly.parse(getClass().getResourceAsStream("issue126.ics")).first(); | ||
|
||
/* | ||
* The first event comes after the last Sunday in October, so it should | ||
* be in standard time (offset of +01:00). | ||
*/ | ||
{ | ||
VEvent event = ical.getEvents().get(0); | ||
|
||
Date expected = date(2023, 11, 22, 9, 30, 0, "+0100"); | ||
Date actual = event.getDateStart().getValue(); | ||
assertEquals(expected, actual); | ||
|
||
expected = date(2023, 11, 22, 12, 0, 0, "+0100"); | ||
actual = event.getDateEnd().getValue(); | ||
assertEquals(expected, actual); | ||
} | ||
|
||
/* | ||
* The second event comes after the last Sunday in March, so it should | ||
* be in daylight time (offset of +02:00). | ||
*/ | ||
{ | ||
VEvent event = ical.getEvents().get(1); | ||
|
||
Date expected = date(2023, 4, 22, 9, 30, 0, "+0200"); | ||
Date actual = event.getDateStart().getValue(); | ||
assertEquals(expected, actual); | ||
|
||
expected = date(2023, 4, 22, 12, 0, 0, "+0200"); | ||
actual = event.getDateEnd().getValue(); | ||
assertEquals(expected, actual); | ||
} | ||
} | ||
} |
Oops, something went wrong.