### Question:
Shape implements FromSourceLocation, Tagged, ToShapeId, Comparable<Shape> { @SuppressWarnings("unchecked") public static <B extends AbstractShapeBuilder<B, S>, S extends Shape> B shapeToBuilder(S shape) { return (B) shape.accept(new ShapeToBuilder()); } @SuppressWarnings("unchecked")  Shape(AbstractShapeBuilder builder, boolean expectMemberSegments); @SuppressWarnings("unchecked") static B shapeToBuilder(S shape); final ShapeType getType(); abstract R accept(ShapeVisitor<R> cases); final ShapeId getId(); boolean hasTrait(String id); boolean hasTrait(ShapeId id); boolean hasTrait(Class<? extends Trait> traitClass); Optional<Trait> findTrait(ShapeId id); Optional<Trait> findTrait(String id); @SuppressWarnings("unchecked") final Optional<T> getTrait(Class<T> traitClass); final T expectTrait(Class<T> traitClass); final Map<ShapeId, Trait> getAllTraits(); Optional<T> getMemberTrait(Model model, Class<T> trait); Optional<Trait> findMemberTrait(Model model, String traitName); Optional<BigDecimalShape> asBigDecimalShape(); Optional<BigIntegerShape> asBigIntegerShape(); Optional<BlobShape> asBlobShape(); Optional<BooleanShape> asBooleanShape(); Optional<ByteShape> asByteShape(); Optional<ShortShape> asShortShape(); Optional<FloatShape> asFloatShape(); Optional<DocumentShape> asDocumentShape(); Optional<DoubleShape> asDoubleShape(); Optional<IntegerShape> asIntegerShape(); Optional<ListShape> asListShape(); Optional<SetShape> asSetShape(); Optional<LongShape> asLongShape(); Optional<MapShape> asMapShape(); Optional<MemberShape> asMemberShape(); Optional<OperationShape> asOperationShape(); Optional<ResourceShape> asResourceShape(); Optional<ServiceShape> asServiceShape(); Optional<StringShape> asStringShape(); Optional<StructureShape> asStructureShape(); Optional<UnionShape> asUnionShape(); Optional<TimestampShape> asTimestampShape(); final boolean isBigDecimalShape(); final boolean isBigIntegerShape(); final boolean isBlobShape(); final boolean isBooleanShape(); final boolean isByteShape(); final boolean isShortShape(); final boolean isFloatShape(); final boolean isDocumentShape(); final boolean isDoubleShape(); final boolean isListShape(); final boolean isSetShape(); final boolean isIntegerShape(); final boolean isLongShape(); final boolean isMapShape(); final boolean isMemberShape(); final boolean isOperationShape(); final boolean isResourceShape(); final boolean isServiceShape(); final boolean isStringShape(); final boolean isStructureShape(); final boolean isUnionShape(); final boolean isTimestampShape(); Collection<MemberShape> members(); @Override ShapeId toShapeId(); @Override final List<String> getTags(); @Override final SourceLocation getSourceLocation(); @Override int compareTo(Shape other); @Override final String toString(); @Override int hashCode(); @Override boolean equals(Object o);  }### Answer:
@Test public void convertsShapeToBuilder() { Shape shape1 = StringShape.builder().id("ns.foo#baz").build(); Shape shape2 = Shape.shapeToBuilder(shape1).build(); StringShape shape3 = Shape.shapeToBuilder(StringShape.builder().id("ns.foo#baz").build()).build(); assertThat(shape1, equalTo(shape2)); assertThat(shape1, equalTo(shape3)); }