/
FeatureTest.groovy
50 lines (41 loc) · 1.71 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
42
43
44
45
46
47
48
49
50
package net.fortuna.ical4j.model.parameter
import net.fortuna.ical4j.AbstractBuilderTest
import net.fortuna.ical4j.data.*
import net.fortuna.ical4j.model.Calendar
import net.fortuna.ical4j.model.TimeZoneRegistryFactory
/**
* Created by fortuna on 6/09/15.
*/
class FeatureTest extends AbstractBuilderTest {
def setup() {
ContentHandlerContext contentHandlerContext = new ContentHandlerContext()
.withParameterFactorySupplier(new ServiceLoaderParameterFactorySupplier())
.withPropertyFactorySupplier(new ServiceLoaderPropertyFactorySupplier())
.withComponentFactorySupplier(new ServiceLoaderComponentFactorySupplier())
builder = new CalendarBuilder(CalendarParserFactory.getInstance().get(),
contentHandlerContext, TimeZoneRegistryFactory.getInstance().createRegistry());
}
def 'assert value stored correctly'() {
given: 'a feature value'
String featureValue = 'AUDIO,CHAT,FEED'
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:VTODO
END:VCALENDAR
'''
when: 'the input is parsed'
Calendar calendar = builder.build(new StringReader(calendarString))
then: 'a valid calendar is realised'
calendar?.components[0].properties[0].getParameter('FEATURE').value == 'AUDIO'
}
}