@Test
public void loadsTrait() {

    TraitFactory provider = TraitFactory.createServiceFactory();
    ArrayNode node = Node.arrayNode(
            Node.objectNode()
                    .withMember("title", Node.from("foo")),
            Node.objectNode()
                    .withMember("title", Node.from("qux"))
                    .withMember("documentation", Node.from("docs"))
                    .withMember("input", Node.objectNode().withMember("a", Node.from("b")))
                    .withMember("output", Node.objectNode().withMember("c", Node.from("d"))));
    Optional<Trait> trait = provider.createTrait(
            ShapeId.from("smithy.api#examples"), ShapeId.from("ns.qux#foo"), node);
    assertTrue(trait.isPresent());
    assertThat(trait.get(), instanceOf(ExamplesTrait.class));
    ExamplesTrait examples = (ExamplesTrait) trait.get();
    assertThat(examples.toNode(), equalTo(node));
    assertThat(examples.toBuilder().build(), equalTo(examples));
}