private void assertFiles(Options options, FileGenerator fileGenerator) { fileGenerator.generateFiles(); File file = new File(options.getOutputDirectory()); assertThat(file.isDirectory(), is(true)); File[] files = file.listFiles(); assertNotNull(files); assertThat((long) files.length, is(options.getNumberOfFileSplits())); // for (File file1:files) { // System.out.println("file1 = " + file1.getName()); // } }
private void assertRecordLength(Options options, int expectedMockLength) throws IOException { File file = new File(options.getOutputDirectory()); assertThat(file.isDirectory(), is(true)); File[] files = file.listFiles(); assertNotNull(files); for (File file1 : files) { BufferedReader reader = new BufferedReader(new FileReader(file1)); String record; while ((record = reader.readLine()) != null) { assertThat(expectedMockLength, is(record.length())); } } }