@Test
public void writeCustomProperty() throws Exception {

    graph.addVertex(
            T.label, Bdio.Class.Project.name(),
            TT.id, BdioObject.randomId(),
            "foobar", "testing");
    commit();
    // First write it out without registering the custom field and verify it doesn't show up
    HeapOutputStream nonCustomBuffer = new HeapOutputStream();
    graph.io(testBdio(TT.Metadata, TT.id)).writeGraph(new BdioFile(nonCustomBuffer));
    assertThatJson(BdioTest.zipEntries(nonCustomBuffer.getInputStream()).get(1))
            .at("/@graph/0").doesNotContainName("foobar");
    // Now write it out with the registered custom data property
    List<Object> expandContext = ImmutableList.of(Bdio.Context.DEFAULT.toString(), ImmutableMap.of("foobar", "http://example.com/gus"));
    HeapOutputStream customBuffer = new HeapOutputStream();
    graph.io(testBdio(TT.Metadata, TT.id).context("", expandContext)).writeGraph(new BdioFile(customBuffer));
    List<String> entries = BdioTest.zipEntries(customBuffer.getInputStream());
    assertThatJson(entries.get(1)).at("/@graph/0").containsName("http://example.com/gus");
    assertThatJson(entries.get(1)).at("/@graph/0").doesNotContainName("foobar");
}