Skip to content

Commit 88872bd

Browse files
committed
add tests for #174 and #206
1 parent 0e723d6 commit 88872bd

File tree

7 files changed

+96
-0
lines changed

7 files changed

+96
-0
lines changed

core/src/test/java/com/github/jsonldjava/core/JsonLdFramingTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,36 @@ public void testFrame0004() throws IOException, JsonLdError {
7575
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0004-out.jsonld"));
7676
assertEquals(out, frame2);
7777
}
78+
79+
@Test
80+
public void testFrame0005() throws IOException, JsonLdError {
81+
final Object frame = JsonUtils
82+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0005-frame.jsonld"));
83+
final Object in = JsonUtils
84+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0005-in.jsonld"));
85+
86+
JsonLdOptions opts = new JsonLdOptions();
87+
opts.setCompactArrays(true);
88+
final Map<String, Object> frame2 = JsonLdProcessor.frame(in, frame, opts);
89+
90+
final Object out = JsonUtils
91+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0005-out.jsonld"));
92+
assertEquals(out, frame2);
93+
}
94+
95+
@Test
96+
public void testFrame0006() throws IOException, JsonLdError {
97+
final Object frame = JsonUtils
98+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0006-frame.jsonld"));
99+
final Object in = JsonUtils
100+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0006-in.jsonld"));
101+
102+
JsonLdOptions opts = new JsonLdOptions();
103+
opts.setCompactArrays(true);
104+
final Map<String, Object> frame2 = JsonLdProcessor.frame(in, frame, opts);
105+
106+
final Object out = JsonUtils
107+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0006-out.jsonld"));
108+
assertEquals(out, frame2);
109+
}
78110
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"@context": {},
3+
"@type": "http://www.myresource/uuidtype"
4+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"@context": {
3+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
4+
},
5+
"@id": "http://www.myresource/uuid",
6+
"@type": "http://www.myresource/uuidtype",
7+
"http://www.myresource.com/ontology/1.0#talksAbout": {
8+
"@list": [
9+
{
10+
"@id": "http://rdf.freebase.com/ns/m.018w8",
11+
"rdfs:label": [
12+
{
13+
"@value": "Basketball",
14+
"@language": "en"
15+
}
16+
]
17+
}
18+
] }
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"@graph" : [ {
3+
"@id" : "http://www.myresource/uuid",
4+
"@type" : "http://www.myresource/uuidtype",
5+
"http://www.myresource.com/ontology/1.0#talksAbout" : {
6+
"@list" : [ {
7+
"@id" : "http://rdf.freebase.com/ns/m.018w8",
8+
"http://www.w3.org/2000/01/rdf-schema#label" : {
9+
"@language" : "en",
10+
"@value" : "Basketball"
11+
}
12+
} ]
13+
}
14+
} ]
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[ {
2+
"@id" : "http://example.com/canvas-1",
3+
"@type" : "http://example.com"
4+
}, {
5+
"@id" : "http://example.com/element",
6+
"http://example.com" : {
7+
"@list" : [ {
8+
"@id" : "http://example.com/canvas-1"
9+
} ]
10+
}
11+
} ]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"@graph" : [ {
3+
"@id" : "http://example.com/canvas-1",
4+
"@type" : "http://example.com"
5+
}, {
6+
"@id" : "http://example.com/element",
7+
"http://example.com" : {
8+
"@list" : [ {
9+
"@id" : "http://example.com/canvas-1",
10+
"@type" : "http://example.com"
11+
} ]
12+
}
13+
} ]
14+
}

0 commit comments

Comments
 (0)