diff --git a/core/src/test/java/com/github/jsonldjava/core/JsonLdFramingTest.java b/core/src/test/java/com/github/jsonldjava/core/JsonLdFramingTest.java index bacec894..95dba1e1 100644 --- a/core/src/test/java/com/github/jsonldjava/core/JsonLdFramingTest.java +++ b/core/src/test/java/com/github/jsonldjava/core/JsonLdFramingTest.java @@ -8,6 +8,7 @@ import org.junit.Test; +import com.github.jsonldjava.core.JsonLdConsts.Embed; import com.github.jsonldjava.utils.JsonUtils; public class JsonLdFramingTest { @@ -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 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); + } } diff --git a/core/src/test/resources/custom/frame-0012-frame.jsonld b/core/src/test/resources/custom/frame-0012-frame.jsonld new file mode 100644 index 00000000..71bf85a4 --- /dev/null +++ b/core/src/test/resources/custom/frame-0012-frame.jsonld @@ -0,0 +1,6 @@ +{ + "@context" : { + "@vocab" : "http://www.example.net/" + }, + "@type" : "Document" +} diff --git a/core/src/test/resources/custom/frame-0012-in.jsonld b/core/src/test/resources/custom/frame-0012-in.jsonld new file mode 100644 index 00000000..97870399 --- /dev/null +++ b/core/src/test/resources/custom/frame-0012-in.jsonld @@ -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" + } + } + ] + } +} \ No newline at end of file diff --git a/core/src/test/resources/custom/frame-0012-out.jsonld b/core/src/test/resources/custom/frame-0012-out.jsonld new file mode 100644 index 00000000..cf1d5367 --- /dev/null +++ b/core/src/test/resources/custom/frame-0012-out.jsonld @@ -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?" + } + } ] + } + } ] +}