@Test void assertsToNodeWorksWithRequiredFields() { TraceMetadata am = new TraceMetadata.Builder() .id("a") .version("b") .type("c") .timestamp("d") .homepage("hp") .typeVersion("tv") .build(); ObjectNode node = am.toNode(); assertThat(node.expectStringMember(TraceMetadata.ID_TEXT).getValue(), equalTo("a")); assertThat(node.expectStringMember(TraceMetadata.VERSION_TEXT).getValue(), equalTo("b")); assertThat(node.expectStringMember(TraceMetadata.TYPE_TEXT).getValue(), equalTo("c")); assertThat(node.expectStringMember(TraceMetadata.TIMESTAMP_TEXT).getValue(), equalTo("d")); assertThat(node.expectStringMember(TraceMetadata.HOMEPAGE_TEXT).getValue(), equalTo("hp")); assertThat(node.expectStringMember(TraceMetadata.TYPE_VERSION_TEXT).getValue(), equalTo("tv")); }
@Override public ObjectNode toNode() { return ObjectNode.objectNodeBuilder() .withMember(ID_TEXT, id) .withMember(VERSION_TEXT, version) .withMember(TYPE_TEXT, type) .withMember(TIMESTAMP_TEXT, timestamp) .withOptionalMember(TYPE_VERSION_TEXT, getTypeVersion().map(Node::from)) .withOptionalMember(HOMEPAGE_TEXT, getHomepage().map(Node::from)) .build(); }
TraceMetadata implements ToNode, ToSmithyBuilder<TraceMetadata> { @Override public ObjectNode toNode() { return ObjectNode.objectNodeBuilder() .withMember(ID_TEXT, id) .withMember(VERSION_TEXT, version) .withMember(TYPE_TEXT, type) .withMember(TIMESTAMP_TEXT, timestamp) .withOptionalMember(TYPE_VERSION_TEXT, getTypeVersion().map(Node::from)) .withOptionalMember(HOMEPAGE_TEXT, getHomepage().map(Node::from)) .build(); } }
TraceMetadata implements ToNode, ToSmithyBuilder<TraceMetadata> { @Override public ObjectNode toNode() { return ObjectNode.objectNodeBuilder() .withMember(ID_TEXT, id) .withMember(VERSION_TEXT, version) .withMember(TYPE_TEXT, type) .withMember(TIMESTAMP_TEXT, timestamp) .withOptionalMember(TYPE_VERSION_TEXT, getTypeVersion().map(Node::from)) .withOptionalMember(HOMEPAGE_TEXT, getHomepage().map(Node::from)) .build(); } private  TraceMetadata(Builder builder); }
TraceMetadata implements ToNode, ToSmithyBuilder<TraceMetadata> { @Override public ObjectNode toNode() { return ObjectNode.objectNodeBuilder() .withMember(ID_TEXT, id) .withMember(VERSION_TEXT, version) .withMember(TYPE_TEXT, type) .withMember(TIMESTAMP_TEXT, timestamp) .withOptionalMember(TYPE_VERSION_TEXT, getTypeVersion().map(Node::from)) .withOptionalMember(HOMEPAGE_TEXT, getHomepage().map(Node::from)) .build(); } private  TraceMetadata(Builder builder); static TraceMetadata fromNode(Node value); static Builder builder(); @Override ObjectNode toNode(); String getId(); String getVersion(); String getTimestamp(); String getType(); Optional<String> getTypeVersion(); Optional<String> getHomepage(); @Override Builder toBuilder(); }
TraceMetadata implements ToNode, ToSmithyBuilder<TraceMetadata> { @Override public ObjectNode toNode() { return ObjectNode.objectNodeBuilder() .withMember(ID_TEXT, id) .withMember(VERSION_TEXT, version) .withMember(TYPE_TEXT, type) .withMember(TIMESTAMP_TEXT, timestamp) .withOptionalMember(TYPE_VERSION_TEXT, getTypeVersion().map(Node::from)) .withOptionalMember(HOMEPAGE_TEXT, getHomepage().map(Node::from)) .build(); } private  TraceMetadata(Builder builder); static TraceMetadata fromNode(Node value); static Builder builder(); @Override ObjectNode toNode(); String getId(); String getVersion(); String getTimestamp(); String getType(); Optional<String> getTypeVersion(); Optional<String> getHomepage(); @Override Builder toBuilder(); static final String ID_TEXT; static final String VERSION_TEXT; static final String TYPE_TEXT; static final String TYPE_VERSION_TEXT; static final String HOMEPAGE_TEXT; static final String TIMESTAMP_TEXT; }