Source:
private void runStandardTest(final int lane, final String jobName, final String libraryParamsFile, final int concatNColumnFields, final String readStructure, final File baseCallsDir, final File testDataDir, final Integer tile) throws Exception { final File outputDir = File.createTempFile(jobName, ".dir"); outputDir.delete(); outputDir.mkdir(); outputDir.deleteOnExit(); final String tilePrefix = (tile != null) ? tile.toString() + "." : ""; final File libraryParams = new File(outputDir, libraryParamsFile); libraryParams.deleteOnExit(); final List<File> samFiles = new ArrayList<File>(); final LineReader reader = new BufferedLineReader(new FileInputStream(new File(testDataDir, libraryParamsFile))); final PrintWriter writer = new PrintWriter(libraryParams); final String header = reader.readLine(); writer.println(header + "\tOUTPUT"); while (true) { final String line = reader.readLine(); if (line == null) { break; } final String[] fields = line.split("\t"); final File outputSam = new File(outputDir, StringUtil.join("", Arrays.copyOfRange(fields, 0, concatNColumnFields)) + ".sam"); outputSam.deleteOnExit(); samFiles.add(new File(outputSam.getParentFile(), tilePrefix + outputSam.getName())); writer.println(line + "\t" + outputSam); } writer.close(); reader.close(); List<String> args = new ArrayList<>(); args.add("BASECALLS_DIR=" + baseCallsDir); args.add("LANE=" + lane); args.add("RUN_BARCODE=HiMom"); args.add("READ_STRUCTURE=" + readStructure); args.add("LIBRARY_PARAMS=" + libraryParams); if(tile != null){ args.add("PROCESS_SINGLE_TILE=" + tile); } Assert.assertEquals(runPicardCommandLine(args), 0); for (final File outputSam : samFiles) { IOUtil.assertFilesEqual(outputSam, new File(testDataDir, outputSam.getName())); outputSam.deleteOnExit(); } TestUtil.recursiveDelete(outputDir); }

Target:
private void runStandardTest(final int lane, final String jobName, final String libraryParamsFile, final int concatNColumnFields, final String readStructure, final File baseCallsDir, final File testDataDir, final Integer tile) throws Exception { final Path outputDir = Files.createTempDirectory(jobName); try { final String tilePrefix = (tile != null) ? tile + "." : ""; final File libraryParams = new File(outputDir.toFile(), libraryParamsFile); libraryParams.deleteOnExit(); final List<File> samFiles = new ArrayList<File>(); final LineReader reader = new BufferedLineReader(new FileInputStream(new File(testDataDir, libraryParamsFile))); final PrintWriter writer = new PrintWriter(libraryParams); final String header = reader.readLine(); writer.println(header + "\tOUTPUT"); while (true) { final String line = reader.readLine(); if (line == null) { break; } final String[] fields = line.split("\t"); final File outputSam = new File(outputDir.toFile(), StringUtil.join("", Arrays.copyOfRange(fields, 0, concatNColumnFields)) + ".sam"); outputSam.deleteOnExit(); samFiles.add(new File(outputSam.getParentFile(), tilePrefix + outputSam.getName())); writer.println(line + "\t" + outputSam); } writer.close(); reader.close(); List<String> args = new ArrayList<>(); args.add("BASECALLS_DIR=" + baseCallsDir); args.add("LANE=" + lane); args.add("RUN_BARCODE=HiMom"); args.add("READ_STRUCTURE=" + readStructure); args.add("LIBRARY_PARAMS=" + libraryParams); if (tile != null) { args.add("PROCESS_SINGLE_TILE=" + tile); } Assert.assertEquals(runPicardCommandLine(args), 0); for (final File outputSam : samFiles) { IOUtil.assertFilesEqual(outputSam, new File(testDataDir, outputSam.getName())); } } finally { TestUtil.recursiveDelete(outputDir.toFile()); Files.delete(outputDir); } }