@Test
public void sortsModelMembers() {

    ModelAssembler assembler = Model.assembler();
    UnionShape u = UnionShape.builder()
            .id("com.foo#U")
            .addMember("zoo", ShapeId.from("smithy.api#String"))
            .addMember("abc", ShapeId.from("smithy.api#String"))
            .build();
    StructureShape s = StructureShape.builder()
            .id("com.foo#S")
            .addMember("zoo", ShapeId.from("smithy.api#String"))
            .addMember("abc", ShapeId.from("smithy.api#String"))
            .build();
    assembler.addShapes(u, s);
    Model model = assembler.assemble().unwrap();
    ModelTransformer transformer = ModelTransformer.create();
    Model sortedModel = transformer.sortMembers(model, Comparator.comparing(MemberShape::getMemberName));
    // Members use given order by default.
    assertThat(u.getMemberNames(), Matchers.contains("zoo", "abc"));
    assertThat(s.getMemberNames(), Matchers.contains("zoo", "abc"));
    // Members in the new model use the sorted order.
    assertThat(sortedModel.expectShape(u.getId(), UnionShape.class).getMemberNames(),
               Matchers.contains("abc", "zoo"));
    assertThat(sortedModel.expectShape(s.getId(), StructureShape.class).getMemberNames(),
               Matchers.contains("abc", "zoo"));
}