@Test
public void convertsToNodeAndBuilder() {

    ShapeId id = ShapeId.from("ns.qux#foo");
    ArrayNode values = Node.arrayNode()
            .withValue(Node.objectNode()
                    .withMember("resource", Node.from("ns.foo#SomeShape"))
                    .withMember("ids", Node.parse("{\"a\": \"a\", \"b\": \"b\"}")))
            .withValue(Node.objectNode()
                    .withMember("resource", Node.from("ns.foo#OtherShape"))
                    .withMember("ids", Node.parse("{\"c\": \"c\"}"))
                    .withMember("rel", Node.from("rel")))
            .withValue(Node.objectNode()
                    .withMember("resource", Node.from("ns.foo#OtherShape"))
                    .withMember("ids", Node.parse("{\"c\": \"c\"}"))
                    .withMember("service", Node.from("foo.baz#Bar")));
    ReferencesTrait trait = new ReferencesTrait.Provider().createTrait(id, values);
    assertThat(trait.toNode(), equalTo(values));
    assertThat(trait.toBuilder().build(), equalTo(trait));
}