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
1 parent
4b91d58
commit a088a53
Showing
9 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/test/groovy/net/fortuna/ical4j/transform/recurrence/ByDayRuleTest.groovy
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,27 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
import net.fortuna.ical4j.model.Date | ||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.WeekDay | ||
import net.fortuna.ical4j.model.WeekDayList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class ByDayRuleTest extends Specification { | ||
|
||
def 'verify transformations by day'() { | ||
given: 'a BYDAY rule' | ||
ByDayRule rule = [new WeekDayList(rulePart), filterType] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
rulePart | filterType | dates | expectedResult | ||
WeekDay.FR | ByDayRule.FilterType.Weekly | [new Date('20150103')] | [new Date('20150102')] | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/groovy/net/fortuna/ical4j/transform/recurrence/ByHourRuleTest.groovy
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,27 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
|
||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.DateTime | ||
import net.fortuna.ical4j.model.NumberList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class ByHourRuleTest extends Specification { | ||
|
||
def 'verify transformations by day'() { | ||
given: 'a BYHOUR rule' | ||
ByHourRule rule = [new NumberList(rulePart)] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE_TIME] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
rulePart | dates | expectedResult | ||
'1' | [new DateTime('20150103T000000Z')] | [new DateTime('20150103T010000Z')] | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/groovy/net/fortuna/ical4j/transform/recurrence/ByMinuteRuleTest.groovy
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,27 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
|
||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.DateTime | ||
import net.fortuna.ical4j.model.NumberList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class ByMinuteRuleTest extends Specification { | ||
|
||
def 'verify transformations by day'() { | ||
given: 'a BYMINUTE rule' | ||
ByMinuteRule rule = [new NumberList(rulePart)] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE_TIME] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
rulePart | dates | expectedResult | ||
'1' | [new DateTime('20150103T000000Z')] | [new DateTime('20150103T000100Z')] | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/groovy/net/fortuna/ical4j/transform/recurrence/ByMonthDayRuleTest.groovy
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,26 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
import net.fortuna.ical4j.model.Date | ||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.NumberList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class ByMonthDayRuleTest extends Specification { | ||
|
||
def 'verify transformations by day'() { | ||
given: 'a BYMONTHDAY rule' | ||
ByMonthDayRule rule = [new NumberList(rulePart)] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
rulePart | dates | expectedResult | ||
'1' | [new Date('20150103')] | [new Date('20150101')] | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/groovy/net/fortuna/ical4j/transform/recurrence/ByMonthRuleTest.groovy
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,26 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
import net.fortuna.ical4j.model.Date | ||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.NumberList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class ByMonthRuleTest extends Specification { | ||
|
||
def 'verify transformations by month'() { | ||
given: 'a bymonth rule' | ||
ByMonthRule rule = [new NumberList(byMonthPart), Optional.empty()] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
byMonthPart | dates | expectedResult | ||
'1,2' | [new Date('20150103')] | [new Date('20150103'), new Date('20150203')] | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/groovy/net/fortuna/ical4j/transform/recurrence/BySecondRuleTest.groovy
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,27 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
|
||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.DateTime | ||
import net.fortuna.ical4j.model.NumberList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class BySecondRuleTest extends Specification { | ||
|
||
def 'verify transformations by day'() { | ||
given: 'a BYSECOND rule' | ||
BySecondRule rule = [new NumberList(rulePart)] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE_TIME] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
rulePart | dates | expectedResult | ||
'1' | [new DateTime('20150103T000000Z')] | [new DateTime('20150103T000001Z')] | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/groovy/net/fortuna/ical4j/transform/recurrence/BySetPosRuleTest.groovy
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,26 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
import net.fortuna.ical4j.model.Date | ||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.NumberList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class BySetPosRuleTest extends Specification { | ||
|
||
def 'verify transformations by day'() { | ||
given: 'a BYSETPOS rule' | ||
BySetPosRule rule = [new NumberList(rulePart)] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
rulePart | dates | expectedResult | ||
'1' | [new Date('20150103')] | [new Date('20150103')] | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/test/groovy/net/fortuna/ical4j/transform/recurrence/ByYearDayRuleTest.groovy
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,26 @@ | ||
package net.fortuna.ical4j.transform.recurrence | ||
|
||
import net.fortuna.ical4j.model.Date | ||
import net.fortuna.ical4j.model.DateList | ||
import net.fortuna.ical4j.model.NumberList | ||
import net.fortuna.ical4j.model.parameter.Value | ||
import spock.lang.Specification | ||
|
||
class ByYearDayRuleTest extends Specification { | ||
|
||
def 'verify transformations by day'() { | ||
given: 'a BYYEARDAY rule' | ||
ByYearDayRule rule = [new NumberList(rulePart)] | ||
|
||
and: 'a list of dates' | ||
DateList dateList = [Value.DATE] | ||
dateList.addAll(dates) | ||
|
||
expect: 'the rule transforms the dates correctly' | ||
rule.transform(dateList) == expectedResult | ||
|
||
where: | ||
rulePart | dates | expectedResult | ||
'1' | [new Date('20150103')] | [new Date('20150101')] | ||
} | ||
} |