@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)); assertThat(u.getMemberNames(), Matchers.contains("zoo", "abc")); assertThat(s.getMemberNames(), Matchers.contains("zoo", "abc")); assertThat(sortedModel.expectShape(u.getId(), UnionShape.class).getMemberNames(), Matchers.contains("abc", "zoo")); assertThat(sortedModel.expectShape(s.getId(), StructureShape.class).getMemberNames(), Matchers.contains("abc", "zoo")); }
SortMembers(Comparator<MemberShape> comparator) { this.comparator = comparator; }
SortMembers { SortMembers(Comparator<MemberShape> comparator) { this.comparator = comparator; } }
SortMembers { SortMembers(Comparator<MemberShape> comparator) { this.comparator = comparator; } SortMembers(Comparator<MemberShape> comparator); }
SortMembers { SortMembers(Comparator<MemberShape> comparator) { this.comparator = comparator; } SortMembers(Comparator<MemberShape> comparator);  }
SortMembers { SortMembers(Comparator<MemberShape> comparator) { this.comparator = comparator; } SortMembers(Comparator<MemberShape> comparator);   }