/
FeatureTest.groovy
41 lines (33 loc) · 1.12 KB
/
FeatureTest.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package net.fortuna.ical4j.extensions.parameter
import net.fortuna.ical4j.data.CalendarBuilder
import net.fortuna.ical4j.model.Calendar
import spock.lang.Specification
/**
* Created by fortuna on 6/09/15.
*/
class FeatureTest extends Specification {
def 'assert value stored correctly'() {
given: 'a feature value'
String featureValue = 'GRAPHIC,THUMBNAIL'
when: 'a feature object is constructed'
Feature feature = [featureValue]
then: 'the object value matches the original value'
feature.value == featureValue
}
def 'assert factory is located correctly'() {
given: 'a sample calendar input'
String calendarString = '''
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ABC Corporation//NONSGML My Product//EN
BEGIN:VTODO
CONFERENCE;VALUE=URI;FEATURE=AUDIO:rtsp://audio.example.com/
event
END:VCALENDAR
'''
when: 'the input is parsed'
Calendar calendar = new CalendarBuilder().build(new StringReader(calendarString))
then: 'a valid calendar is realised'
calendar?.components[0].properties[0].getParameter('FEATURE').value == 'AUDIO'
}
}