@Test public void updatesMapMembersWhenContainerUpdated() { ShapeId stringId = ShapeId.from("ns.foo#String"); ShapeId containerId = ShapeId.from("ns.foo#Container"); ShapeId keyId = ShapeId.from("ns.foo#Container$key"); ShapeId valueId = ShapeId.from("ns.foo#Container$value"); StringShape target = StringShape.builder().id(stringId).build(); MemberShape keyMember = MemberShape.builder().id(keyId).target(stringId).build(); MemberShape valueMember = MemberShape.builder().id(valueId).target(stringId).build(); MapShape container = MapShape.builder().id(containerId).key(keyMember).value(valueMember).build(); Model model = Model.builder() .addShapes(target, keyMember, valueMember, container) .build(); ModelTransformer transformer = ModelTransformer.create(); ShapeId newContainerId = ShapeId.from("ns.bar#Baz"); ShapeId newKeyId = ShapeId.from("ns.bar#Baz$key"); ShapeId newValueId = ShapeId.from("ns.bar#Baz$value"); Map<ShapeId, ShapeId> renamed = new HashMap<>(); renamed.put(containerId, newContainerId); Model result = transformer.renameShapes(model, renamed); assertTrue(result.getShape(newContainerId).isPresent()); MapShape newContainer = result.getShape(newContainerId).get().asMapShape().get(); assertEquals(newContainer.getKey().getId(), newKeyId); assertEquals(newContainer.getValue().getId(), newValueId); 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);   }