@Test public void shouldReplaceForkNumberPath() { File root = new File( System.getProperty( "user.dir", "" ) ); File pathWithPlaceholder = new File( root, "${surefire.forkNumber}" ); File changed = SurefireHelper.replaceForkThreadsInPath( pathWithPlaceholder, 5 ); assertThat( changed.getPath() ) .isEqualTo( new File( root, "5" ).getPath() ); }
public static File replaceForkThreadsInPath( File path, int replacement ) { Deque<String> dirs = new LinkedList<>(); File root = path; while ( !root.exists() ) { dirs.addFirst( replaceThreadNumberPlaceholders( root.getName(), replacement ) ); root = root.getParentFile(); } File replacedPath = root; for ( String dir : dirs ) { replacedPath = new File( replacedPath, dir ); } return replacedPath; }
SurefireHelper { public static File replaceForkThreadsInPath( File path, int replacement ) { Deque<String> dirs = new LinkedList<>(); File root = path; while ( !root.exists() ) { dirs.addFirst( replaceThreadNumberPlaceholders( root.getName(), replacement ) ); root = root.getParentFile(); } File replacedPath = root; for ( String dir : dirs ) { replacedPath = new File( replacedPath, dir ); } return replacedPath; } }
SurefireHelper { public static File replaceForkThreadsInPath( File path, int replacement ) { Deque<String> dirs = new LinkedList<>(); File root = path; while ( !root.exists() ) { dirs.addFirst( replaceThreadNumberPlaceholders( root.getName(), replacement ) ); root = root.getParentFile(); } File replacedPath = root; for ( String dir : dirs ) { replacedPath = new File( replacedPath, dir ); } return replacedPath; } private  SurefireHelper(); }
SurefireHelper { public static File replaceForkThreadsInPath( File path, int replacement ) { Deque<String> dirs = new LinkedList<>(); File root = path; while ( !root.exists() ) { dirs.addFirst( replaceThreadNumberPlaceholders( root.getName(), replacement ) ); root = root.getParentFile(); } File replacedPath = root; for ( String dir : dirs ) { replacedPath = new File( replacedPath, dir ); } return replacedPath; } private  SurefireHelper(); @Nonnull static String replaceThreadNumberPlaceholders( @Nonnull String argLine, int threadNumber ); static File replaceForkThreadsInPath( File path, int replacement ); static String[] getDumpFilesToPrint(); static void reportExecution( SurefireReportParameters reportParameters, RunResult result,
                                        PluginConsoleLogger log, Exception firstForkException ); static List<CommandLineOption> commandLineOptions( MavenSession session, PluginConsoleLogger log ); static void logDebugOrCliShowErrors( String s, PluginConsoleLogger log, Collection<CommandLineOption> cli ); static String escapeToPlatformPath( String path ); }
SurefireHelper { public static File replaceForkThreadsInPath( File path, int replacement ) { Deque<String> dirs = new LinkedList<>(); File root = path; while ( !root.exists() ) { dirs.addFirst( replaceThreadNumberPlaceholders( root.getName(), replacement ) ); root = root.getParentFile(); } File replacedPath = root; for ( String dir : dirs ) { replacedPath = new File( replacedPath, dir ); } return replacedPath; } private  SurefireHelper(); @Nonnull static String replaceThreadNumberPlaceholders( @Nonnull String argLine, int threadNumber ); static File replaceForkThreadsInPath( File path, int replacement ); static String[] getDumpFilesToPrint(); static void reportExecution( SurefireReportParameters reportParameters, RunResult result,
                                        PluginConsoleLogger log, Exception firstForkException ); static List<CommandLineOption> commandLineOptions( MavenSession session, PluginConsoleLogger log ); static void logDebugOrCliShowErrors( String s, PluginConsoleLogger log, Collection<CommandLineOption> cli ); static String escapeToPlatformPath( String path ); static final String DUMP_FILE_PREFIX; static final String DUMP_FILENAME_FORMATTER; static final String DUMPSTREAM_FILENAME_FORMATTER; static final String DUMPSTREAM_FILENAME; static final String DUMP_FILENAME; }