Skip to content

Commit

Permalink
Test by rule parts
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Dec 11, 2018
1 parent 132a717 commit 4b91d58
Showing 1 changed file with 27 additions and 0 deletions.
@@ -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.NumberList
import net.fortuna.ical4j.model.parameter.Value
import spock.lang.Specification

class ByWeekNoRuleTest extends Specification {

def 'verify transformations by week number'() {
given: 'a byweekno rule'
ByWeekNoRule rule = [new NumberList(byWeekNoPart)]

and: 'a list of dates'
DateList dateList = [Value.DATE]
dateList.addAll(dates)

expect: 'the rule transforms the dates correctly'
rule.transform(dateList) == expectedResult

where:
byWeekNoPart | dates | expectedResult
'1,2,3' | [new Date('20150103')] | [new Date('20150103'), new Date('20150110'), new Date('20150117')]
'1,3,5' | [new Date('20150630')] | [new Date('20141230'), new Date('20150113'), new Date('20150127')]
}
}

0 comments on commit 4b91d58

Please sign in to comment.