PersistenceXmlWriter { public String generate(List<String> classes) { StringBuilder s = new StringBuilder(); for (String cls : classes) s.append("\t\t<class>" + cls + "</class>\n"); try { String xml = IOUtils.toString( PersistenceXmlWriter.class.getResourceAsStream("/persistence-template.txt")); return xml.replace("CLASSES HERE", s.toString()); } catch (IOException e) { throw new RuntimeException(e); } }  String generate(List<String> classes);  }
@Test public void test() { String s = new PersistenceXmlWriter().generate(Lists.newArrayList("bingorama")); System.out.println(s); Assert.assertTrue(s.contains("bingorama")); }