Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.junit.Test;

import com.github.jsonldjava.core.JsonLdConsts.Embed;
import com.github.jsonldjava.utils.JsonUtils;

public class JsonLdFramingTest {
Expand Down Expand Up @@ -195,4 +196,21 @@ public void testFrame0011() throws IOException, JsonLdError {
assertEquals(out, frame2);
}

@Test
public void testFrame0012() throws IOException, JsonLdError {
final Object frame = JsonUtils
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0012-frame.jsonld"));
final Object in = JsonUtils
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0012-in.jsonld"));

final JsonLdOptions opts = new JsonLdOptions();
opts.setEmbed(Embed.LAST);
final Map<String, Object> frame2 = JsonLdProcessor.frame(in, frame, opts);

//TODO remove this debugging line after test is fixed
System.out.println(JsonUtils.toPrettyString(frame2));
final Object out = JsonUtils
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0012-out.jsonld"));
assertEquals(out, frame2);
}
}
6 changes: 6 additions & 0 deletions core/src/test/resources/custom/frame-0012-frame.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context" : {
"@vocab" : "http://www.example.net/"
},
"@type" : "Document"
}
22 changes: 22 additions & 0 deletions core/src/test/resources/custom/frame-0012-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"@context" : {
"@vocab" : "http://www.example.net/"
},
"@id": "#doc",
"@type": "Document",
"content": {
"@list": [
{
"@id": "#question",
"@type": "Question",
"label" : "Why am I here twice?"
},
{
"@id": "#block",
"predicate": {
"@id": "#question"
}
}
]
}
}
21 changes: 21 additions & 0 deletions core/src/test/resources/custom/frame-0012-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"@context" : {
"@vocab" : "http://www.example.net/"
},
"@graph" : [ {
"@id" : "#doc",
"@type" : "Document",
"content" : {
"@list" : [ {
"@id" : "#question"
}, {
"@id" : "#block",
"predicate" : {
"@id" : "#question",
"@type" : "Question",
"label" : "Why am I here twice?"
}
} ]
}
} ]
}