@Test
public void doesNotOverwriteOtherContainerUpdatesWhenAlsoUpdatingMembers() {

    ShapeId stringId = ShapeId.from("ns.foo#String");
    ShapeId containerId = ShapeId.from("ns.foo#Container");
    ShapeId memberId = ShapeId.from("ns.foo#Container$member");
    StringShape target = StringShape.builder().id(stringId).build();
    MemberShape member = MemberShape.builder().id(memberId).target(stringId).build();
    ListShape container = ListShape.builder().id(containerId).member(member).build();
    Model model = Model.builder()
            .addShapes(target, member, container)
            .build();
    ModelTransformer transformer = ModelTransformer.create();
    ListShape newContainer = container.toBuilder()
            .addTrait(LengthTrait.builder()
                              .min(1L)
                              .max(2L)
                              .sourceLocation(SourceLocation.NONE)
                              .build())
            .build();
    MemberShape newMember = MemberShape.builder()
            .id(memberId)
            .target(stringId)
            .addTrait(new SensitiveTrait())
            .build();
    Model result = transformer.replaceShapes(model, Arrays.asList(newMember, newContainer));
    // Make sure the member has the trait that was applied.
    assertThat(result.getShape(memberId).get().getTrait(SensitiveTrait.class), Matchers.not(Optional.empty()));
    // Ensure that the list shape changes were not overwritten.
    assertThat(result.getShape(containerId).get().asListShape().get().getTrait(LengthTrait.class),
                      Matchers.not(Optional.empty()));
    // Ensure that the list shape has the new member.
    assertThat(result.getShape(containerId).get().asListShape().get().getMember(), Matchers.is(newMember));
}