@Override
    public Node toNode() {
        ObjectNode.Builder builder = Node.objectNodeBuilder();
        if (this.isSuccess()) {
            builder.withMember(SUCCESS, Node.objectNode());
        } else {
            Node failureNode = this.getFailure()
                    .map(FailureExpectation::toNode)
                    .orElse(Node.objectNode());
            builder.withMember(FAILURE, failureNode);
        }
        return builder.build();
    }
@return The expected failure, if this expectation is a failure expectation.
smithy-smoke-test-traits/src/main/java/software/amazon/smithy/smoketests/traits/Expectation.java