### Question:
StructureGenerator implements Runnable { @Override public void run() { if (shape.hasTrait(ErrorTrait.class)) { renderErrorStructure(); } else { renderNonErrorStructure(); } } StructureGenerator(Model model, SymbolProvider symbolProvider, TypeScriptWriter writer, StructureShape shape); @Override void run();  }### Answer:
@Test public void generatesNonErrorStructures() { StructureShape struct = createNonErrorStructure(); ModelAssembler assembler = Model.assembler().addShape(struct); struct.getAllMembers().values().forEach(assembler::addShape); Model model = assembler.assemble().unwrap(); TypeScriptWriter writer = new TypeScriptWriter("./foo"); new StructureGenerator(model, TypeScriptCodegenPlugin.createSymbolProvider(model), writer, struct).run(); String output = writer.toString(); assertThat(output, containsString("export interface Bar {")); assertThat(output, containsString("foo?: string;")); assertThat(output, containsString("export namespace Bar {")); }
@Test public void generatesNonErrorStructuresThatExtendOtherInterfaces() { StructureShape struct = createNonErrorStructure(); ModelAssembler assembler = Model.assembler().addShape(struct); struct.getAllMembers().values().forEach(assembler::addShape); OperationShape operation = OperationShape.builder().id("com.foo#Operation").output(struct).build(); assembler.addShape(operation); Model model = assembler.assemble().unwrap(); TypeScriptWriter writer = new TypeScriptWriter("./foo"); new StructureGenerator(model, TypeScriptCodegenPlugin.createSymbolProvider(model), writer, struct).run(); String output = writer.toString(); assertThat(output, containsString("export interface Bar {")); }