-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathMiscellaneousFactsExampleTest.java
More file actions
127 lines (115 loc) · 5.2 KB
/
MiscellaneousFactsExampleTest.java
File metadata and controls
127 lines (115 loc) · 5.2 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package org.gedcomx.examples;
import org.gedcomx.Gedcomx;
import org.gedcomx.common.Qualifier;
import org.gedcomx.common.URI;
import org.gedcomx.conclusion.*;
import org.gedcomx.rt.DataURIUtil;
import org.gedcomx.rt.SerializationUtil;
import org.gedcomx.types.FactQualifierType;
import org.gedcomx.types.FactType;
import org.gedcomx.types.RelationshipType;
import org.junit.jupiter.api.Test;
/**
* @author Ryan Heaton
*/
class MiscellaneousFactsExampleTest {
@Test
void censusAndResidenceLikeFacts() throws Exception {
Person person = new Person()
.fact(new Fact(FactType.Census, "...", "..."))
.fact(new Fact(FactType.Emigration, "...", "..."))
.fact(new Fact(FactType.Immigration, "...", "..."))
.fact(new Fact(FactType.LandTransaction, "...", "..."))
.fact(new Fact(FactType.MoveTo, "...", "..."))
.fact(new Fact(FactType.MoveFrom, "...", "..."))
.fact(new Fact(FactType.Residence, "...", "..."));
Gedcomx gx = new Gedcomx().person(person);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
@Test
void militaryServiceFacts() throws Exception {
Person person = new Person()
.fact(new Fact(FactType.MilitaryAward, "...", "..."))
.fact(new Fact(FactType.MilitaryDischarge, "...", "..."))
.fact(new Fact(FactType.MilitaryDraftRegistration, "...", "..."))
.fact(new Fact(FactType.MilitaryInduction, "...", "..."))
.fact(new Fact(FactType.MilitaryService, "...", "..."));
Gedcomx gx = new Gedcomx().person(person);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
@Test
void educationAndOccupationFacts() throws Exception {
Person person = new Person()
.fact(new Fact(FactType.Apprenticeship, "...", "..."))
.fact(new Fact(FactType.Education, "...", "..."))
.fact(new Fact(FactType.Occupation, "...", "..."))
.fact(new Fact(FactType.Retirement, "...", "..."));
Gedcomx gx = new Gedcomx().person(person);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
@Test
void religiousOrCulturalFacts() throws Exception {
Person person = new Person()
.fact(new Fact(FactType.AdultChristening, "...", "..."))
.fact(new Fact(FactType.Baptism, "...", "..."))
.fact(new Fact(FactType.BarMitzvah, "...", "..."))
.fact(new Fact(FactType.BatMitzvah, "...", "..."))
.fact(new Fact(FactType.Caste, "...", "..."))
.fact(new Fact(FactType.Christening, "...", "..."))
.fact(new Fact(FactType.Circumcision, "...", "..."))
.fact(new Fact(FactType.Clan, "...", "..."))
.fact(new Fact(FactType.Confirmation, "...", "..."))
.fact(new Fact(FactType.Excommunication, "...", "..."))
.fact(new Fact(FactType.FirstCommunion, "...", "..."))
.fact(new Fact(FactType.Nationality, "...", "..."))
.fact(new Fact(FactType.Ordination, "...", "..."))
.fact(new Fact(FactType.Religion, "...", "..."))
.fact(new Fact(FactType.Yahrzeit, "...", "..."));
Gedcomx gx = new Gedcomx().person(person);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
@Test
void factQualifiers() throws Exception {
Person person = new Person()
.fact(new Fact(FactType.Christening, "...", "...").qualifier(new Qualifier(FactQualifierType.Religion, "Catholic")))
.fact(new Fact(FactType.Census, "...", "...").qualifier(new Qualifier(FactQualifierType.Age, "44")))
.fact(new Fact(FactType.Death, "...", "...").qualifier(new Qualifier(FactQualifierType.Cause, "Heart failure")));
Gedcomx gx = new Gedcomx().person(person);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
@Test
void customFact() throws Exception {
Person person = new Person()
.fact(new Fact().type(URI.create(DataURIUtil.encodeDataURI("Eagle Scout").toString())).place(new PlaceReference().original("...")).date(new Date().original("...")));
Gedcomx gx = new Gedcomx().person(person);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
@Test
void relationshipFacts() throws Exception {
Relationship couple = new Relationship()
.type(RelationshipType.Couple)
.fact(new Fact(FactType.CivilUnion, "...", "..."))
.fact(new Fact(FactType.DomesticPartnership, "...", "..."))
.fact(new Fact(FactType.Divorce, "...", "..."))
.fact(new Fact(FactType.Marriage, "...", "..."))
.fact(new Fact(FactType.MarriageBanns, "...", "..."))
.fact(new Fact(FactType.MarriageContract, "...", "..."))
.fact(new Fact(FactType.MarriageLicense, "...", "..."));
Relationship parentChild = new Relationship()
.type(RelationshipType.ParentChild)
.fact(new Fact(FactType.AdoptiveParent, "...", "..."))
.fact(new Fact(FactType.BiologicalParent, "...", "..."))
.fact(new Fact(FactType.FosterParent, "...", "..."))
.fact(new Fact(FactType.GuardianParent, "...", "..."))
.fact(new Fact(FactType.StepParent, "...", "..."));
Gedcomx gx = new Gedcomx().relationship(couple).relationship(parentChild);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
}