@Test public void updatesStructureMembersWhenContainerUpdated() { 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(target).build(); StructureShape container = StructureShape.builder().id(containerId).addMember(member).build(); Model model = Model.builder() .addShapes(target, member, container) .build(); ModelTransformer transformer = ModelTransformer.create(); ShapeId newContainerId = ShapeId.from("ns.bar#Baz"); ShapeId newMemberId = ShapeId.from("ns.bar#Baz$member"); Map<ShapeId, ShapeId> renamed = new HashMap<>(); renamed.put(containerId, newContainerId); Model result = transformer.renameShapes(model, renamed); assertTrue(result.getShape(newContainerId).isPresent()); StructureShape newContainer = result.getShape(newContainerId).get().asStructureShape().get(); newContainer.getMember("member").ifPresent(newMember -> { assertEquals(newMember.getId(), newMemberId); }); assertFalse(result.getShape(containerId).isPresent()); }
RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier) { this.renamed = new HashMap<>(renamed); this.assembler = modelAssemblerSupplier.get(); }
RenameShapes { RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier) { this.renamed = new HashMap<>(renamed); this.assembler = modelAssemblerSupplier.get(); } }
RenameShapes { RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier) { this.renamed = new HashMap<>(renamed); this.assembler = modelAssemblerSupplier.get(); } RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier); }
RenameShapes { RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier) { this.renamed = new HashMap<>(renamed); this.assembler = modelAssemblerSupplier.get(); } RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier);  }
RenameShapes { RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier) { this.renamed = new HashMap<>(renamed); this.assembler = modelAssemblerSupplier.get(); } RenameShapes(Map<ShapeId, ShapeId> renamed, Supplier<ModelAssembler> modelAssemblerSupplier);   }