### Question:
ConvertXSQT { public void convert(File source, File dest, File scheme) { TransformerFactory factory = TransformerFactory.newInstance(); try { Transformer transformer = factory.newTransformer(new StreamSource(scheme)); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http: transformer.transform(new StreamSource(source), new StreamResult(dest)); } catch (TransformerException e) { e.printStackTrace(); } }  void convert(File source, File dest, File scheme);  }### Answer:
@Test public void testConvert() { ConvertXSQT converter = new ConvertXSQT(); File source = new File(getClass().getClassLoader().getResource("ConvertXSQTtestSource.xml").getFile()); File dest = new File(getClass().getClassLoader().getResource("ConvertXSQTtestDest.xml").getFile()); File scheme = new File(getClass().getClassLoader().getResource("scheme.xsl").getFile()); converter.convert(source, dest, scheme); StringBuilder result = new StringBuilder(); try (Scanner scan = new Scanner(dest)) { while (scan.hasNext()) { result.append(scan.nextLine()); } } catch (FileNotFoundException e) { e.printStackTrace(); } String expect = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><entries>" + " <entry field=\"0\"/>" + " <entry field=\"1\"/>" + "</entries>"; assertThat(result.toString(), is(expect)); }