@Test public void updatesTaggedUnionShapeWhenMemberChanges() { ShapeId stringId = ShapeId.from("ns.foo#String"); ShapeId containerId = ShapeId.from("ns.foo#Container"); ShapeId memberAId = ShapeId.from("ns.foo#Container$a"); ShapeId memberBId = ShapeId.from("ns.foo#Container$b"); StringShape target = StringShape.builder().id(stringId).build(); MemberShape memberA = MemberShape.builder().id(memberAId).target(stringId).build(); MemberShape memberB = MemberShape.builder().id(memberBId).target(stringId).build(); UnionShape container = UnionShape.builder() .id(containerId) .addMember(memberA) .addMember(memberB) .build(); Model model = Model.builder() .addShapes(target, memberA, memberB, container) .build(); ModelTransformer transformer = ModelTransformer.create(); MemberShape newMemberB = MemberShape.builder() .id(memberBId) .target(stringId) .addTrait(new SensitiveTrait()) .build(); Model result = transformer.replaceShapes(model, Arrays.asList(newMemberB)); assertThat(result.getShape(memberBId).get().getTrait(SensitiveTrait.class), Matchers.not(Optional.empty())); assertThat(result.getShape(containerId).get().asUnionShape().get().getMember("b").get(), Matchers.is(newMemberB)); }
ReplaceShapes(Collection<Shape> replacements) { this.replacements = Objects.requireNonNull(replacements); }
ReplaceShapes { ReplaceShapes(Collection<Shape> replacements) { this.replacements = Objects.requireNonNull(replacements); } }
ReplaceShapes { ReplaceShapes(Collection<Shape> replacements) { this.replacements = Objects.requireNonNull(replacements); } ReplaceShapes(Collection<Shape> replacements); }
ReplaceShapes { ReplaceShapes(Collection<Shape> replacements) { this.replacements = Objects.requireNonNull(replacements); } ReplaceShapes(Collection<Shape> replacements);  }
ReplaceShapes { ReplaceShapes(Collection<Shape> replacements) { this.replacements = Objects.requireNonNull(replacements); } ReplaceShapes(Collection<Shape> replacements);   }