@Test public void updatesIdRefValues() { Model model = Model.assembler() .addImport(IntegTest.class.getResource("rename-shape-test-model.json")) .assemble() .unwrap(); Map<ShapeId, ShapeId> renamed = new HashMap<>(); ShapeId fromId = ShapeId.from("ns.foo#OldShape"); ShapeId toId = ShapeId.from("ns.foo#NewShape"); renamed.put(fromId, toId); ModelTransformer transformer = ModelTransformer.create(); Model result = transformer.renameShapes(model, renamed); StringNode node = Node.from(toId.toShapeId().toString()); assertTrue(result.getShape(toId).isPresent()); assertFalse(result.getShape(fromId).isPresent()); Shape shape = result.expectShape(ShapeId.from("ns.foo#ValidShape")); Trait trait = shape.findTrait("ns.foo#integerRef").get(); assertEquals(trait.toNode(), node); }
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);   }