@Test void validators() throws Exception { Configuration config = Configuration.builder() .addValidatorConfig(new ValidatorConfiguration("Mega")) .addValidatorConfig(new ValidatorConfiguration("Super").addProperty("hello", "world")).build(); exporter.export(config, out); assertEquals( "<redpen-conf lang=\"en\">\n" + " <validators>\n" + " <validator name=\"Mega\"/>\n" + " <validator name=\"Super\">\n" + " <property name=\"hello\" value=\"world\"/>\n" + " </validator>\n" + " </validators>\n" + "</redpen-conf>", out.toString()); }
public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } } }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }  }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }  void export(Configuration config, OutputStream out); }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }  void export(Configuration config, OutputStream out);  }