/
LabelTest.groovy
42 lines (34 loc) · 1.23 KB
/
LabelTest.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
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 LabelTest extends Specification {
def 'assert value stored correctly'() {
given: 'a label value'
String labelValue = 'Chat room:xmpp:chat-123@conference.example.com'
when: 'a label object is constructed'
Label label = [labelValue]
then: 'the object value matches the original address'
label.value == labelValue
}
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=VIDEO;
LABEL="Web video chat, access code=76543";
:http://video-chat.example.com/;group-id=1234END:VTODO
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('LABEL').value == 'Web video chat, access code=76543'
}
}