package de.retest.recheck;

import java.io.File;

import de.retest.recheck.persistence.FileNamer;

public class MavenConformFileNamerStrategy implements FileNamerStrategy {

	public static final String DEFAULT_RETEST_WORKSPACE_PATH = "src/test/resources/retest/";
	public static final String DEFAULT_RETEST_TESTREPORTS_PATH = "target/test-classes/retest/";

	@Override
	public FileNamer createFileNamer( final String... baseNames ) {
		return new FileNamer() {
			@Override
			public File getFile( final String extension ) {
				final String baseName = String.join( "/", baseNames );
				return new File( DEFAULT_RETEST_WORKSPACE_PATH + File.separator + Properties.RECHECK_FOLDER_NAME
						+ File.separator + baseName + extension );
			}

			@Override
			public File getResultFile( final String extension ) {
				final String baseName = String.join( "/", baseNames );
				return new File( DEFAULT_RETEST_TESTREPORTS_PATH + File.separator + Properties.RECHECK_FOLDER_NAME
						+ File.separator + baseName + extension );
			}
		};
	}

}

@@ -21,16 +21,81 @@
 check;%0A%0A
+import static de.retest.recheck.Properties.RECHECK_FOLDER_NAME;%0A%0A
 import j
@@ -591,62 +591,153 @@
 %09%09%09%09
-final String baseName = String.join( %22/%22, baseNames );
+return toFile( DEFAULT_RETEST_WORKSPACE_PATH, extension, baseNames );%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public File getResultFile( final String extension ) %7B
 %0A%09%09%09
@@ -736,36 +736,34 @@
  ) %7B%0A%09%09%09%09return 
-new 
+to
 File( DEFAULT_RE
@@ -771,118 +771,46 @@
 EST_
-WORKSPACE_PATH + File.separator + Properties.RECHECK_FOLDER_NAME%0A%09%09%09%09%09%09+ File.separator + baseName + extension
+TESTREPORTS_PATH, extension, baseNames
  );%0A
@@ -818,81 +818,114 @@
 %09%09%7D%0A
-%0A
 %09%09
-%09@Override%0A%09%09%09public File getResultFile( final String extension
+%7D;%0A%09%7D%0A%0A%09private File toFile( final String prefix, final String extension, final String... baseNames
  ) %7B%0A
-%09%09
 %09%09fi
@@ -963,11 +963,22 @@
 in( 
-%22/%22
+File.separator
 , ba
@@ -988,18 +988,16 @@
 ames );%0A
-%09%09
 %09%09return
@@ -1011,39 +1011,14 @@
 le( 
-DEFAULT_RETEST_TESTREPORTS_PATH
+prefix
  + F
@@ -1033,27 +1033,16 @@
 rator + 
-Properties.
 RECHECK_
@@ -1056,15 +1056,9 @@
 NAME
-%0A%09%09%09%09%09%09
+ 
 + Fi
@@ -1092,28 +1092,18 @@
 xtension );%0A
-%09%09%09%7D%0A%09%09%7D;%0A
 %09%7D%0A%0A%7D%0A

Extract duplicate code