Skip to content

Commit 2ac517f

Browse files
committed
Add regression test for issue #174
Signed-off-by: Peter Ansell <p_ansell@yahoo.com>
1 parent 4aa9f61 commit 2ac517f

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,23 @@ public void testFrame0002() throws IOException, JsonLdError {
4141
assertEquals(out, frame2);
4242
}
4343

44+
@Test
45+
public void testFrame0003() throws IOException, JsonLdError {
46+
final Object frame = JsonUtils
47+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0003-frame.jsonld"));
48+
final Object in = JsonUtils
49+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0003-in.jsonld"));
50+
51+
JsonLdOptions opts = new JsonLdOptions();
52+
final Map<String, Object> frame2 = JsonLdProcessor.frame(in, frame, opts);
53+
54+
final Object out = JsonUtils
55+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0003-out.jsonld"));
56+
System.out.println(JsonUtils.toPrettyString(in));
57+
System.out.println(JsonUtils.toPrettyString(out));
58+
System.out.println(JsonUtils.toPrettyString(frame2));
59+
assertEquals(out, frame2);
60+
}
61+
62+
4463
}
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)