-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathAppointmentTest.java
More file actions
73 lines (60 loc) · 2.26 KB
/
AppointmentTest.java
File metadata and controls
73 lines (60 loc) · 2.26 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.pff;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Calendar;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Tests for {@link PSTAppointment}.
*
* @author Richard Johnson
*/
@RunWith(JUnit4.class)
public class AppointmentTest {
/**
* Test we can access appointments from the PST.
*/
@Test
public final void testGetDistList()
throws PSTException, IOException, URISyntaxException {
URL dirUrl = ClassLoader.getSystemResource("dist-list.pst");
PSTFile pstFile = new PSTFile(new File(dirUrl.toURI()));
PSTAppointment appt = (PSTAppointment) PSTObject.detectAndLoadPSTObject(pstFile, 2097348);
PSTAppointmentRecurrence r = new PSTAppointmentRecurrence(
appt.getRecurrenceStructure(), appt, appt.getRecurrenceTimeZone());
Assert.assertEquals(
"Has 3 deleted items (1 removed, 2 changed)",
3,
r.getDeletedInstanceDates().length);
Assert.assertEquals(
"Number of Exceptions",
2,
r.getExceptionCount());
String d = r.getException(0).getDescription().trim();
Assert.assertEquals("correct app desc", "This is the appointment at 9", d);
Calendar c = PSTObject.apptTimeToCalendar(
r.getException(0).getStartDateTime());
Assert.assertEquals(
"First exception correct hour",
9,
c.get(Calendar.HOUR));
d = r.getException(1).getDescription().trim();
Assert.assertEquals("correct app desc", "This is the one at 10", d);
c = PSTObject.apptTimeToCalendar(
r.getException(1).getStartDateTime());
Assert.assertEquals(
"Second exception correct hour",
10,
c.get(Calendar.HOUR));
//System.out.println(r.getExceptionCount());
//System.out.println(r.getException(0).getDTStamp());
//for (int x = 0; x < r.getDeletedInstanceDates().length; x++) {
// System.out.println(r.getDeletedInstanceDates()[x]);
//}
}
}