private void assertExpectedSnippetFilesExist(String identifier, String... snippets) { for (String snippet : snippets) { File snippetFile = new File(new File("test-output/generated-snippets/" + identifier), snippet); Assert.assertTrue(snippetFile.isFile(), "Snippet " + snippetFile + " not found"); } }
private File createDelimitedFile(Set<TestBean> theBeans) { File aDelimitedFile = null; try { // Create a temporary file ... aDelimitedFile = createTempFile(this.getClass().getName(), ".csv"); aDelimitedFile.deleteOnExit(); // Write the set of beans out to the file ... BufferedWriter aWriter = new BufferedWriter(new FileWriter(aDelimitedFile)); for (TestBean aBean : theBeans) { StringBuilder aStringBuilder = new StringBuilder(); aStringBuilder.append(aBean.getFirstName()); aStringBuilder.append(DEFAULT_DELIMITER); aStringBuilder.append(aBean.getLastName()); aStringBuilder.append(DEFAULT_DELIMITER); aStringBuilder.append(aBean.getFavoriteColor()); aWriter.append(aStringBuilder); aWriter.newLine(); } // File all buffers and close up shop ... aWriter.flush(); aWriter.close(); } catch (IOException e) { fail("Failed to create test delimited file.", e); } return aDelimitedFile; }