package de.retest.recheck;

import java.io.File;

import com.google.common.base.Joiner;

import de.retest.persistence.FileNamer;

public class MavenConformFileNamerStrategy implements FileNamerStrategy {

	@Override
	public FileNamer createFileNamer( final String... baseNames ) {
		return new FileNamer() {

			@Override
			public File getFile( final String extension ) {
				final String baseName = Joiner.on( "/" ).join( baseNames );
				return new File( "src/test/resources/retest/"
						+ System.getProperty( RECHECK_FOLDER_PROPERTY, RECHECK_FOLDER_DEFAULT ) + File.separator
						+ baseName + extension );
			}

			@Override
			public File getResultFile( final String extension ) {
				final String baseName = Joiner.on( "/" ).join( baseNames );
				return new File( "target/test-classes/retest/"
						+ System.getProperty( RECHECK_FOLDER_PROPERTY, RECHECK_FOLDER_DEFAULT ) + File.separator
						+ baseName + extension );
			}
		};
	}

	@Override
	public String getTestClassName() {
		final StackTraceElement testMethodStack = TestCaseFinder.findTestCaseMethodInStack();
		if ( testMethodStack != null ) {
			final String className = testMethodStack.getClassName();
			return className;
		}
		throw new RuntimeException( "Couldn't identify test method in call stack. Use explicit namer!" );
	}

	@Override
	public String getTestMethodName() {
		final StackTraceElement testMethodStack = TestCaseFinder.findTestCaseMethodInStack();
		if ( testMethodStack != null ) {
			return testMethodStack.getMethodName();
		}
		throw new RuntimeException( "Couldn't identify test method in call stack. Use explicit namer!" );
	}
}

@@ -198,16 +198,95 @@
 tegy %7B%0A%0A
+%09public static final String WORKSPACE_DEFAULT = %22src/test/resources/retest/%22;%0A%0A
 %09@Overri
@@ -533,44 +533,33 @@
 ile(
- %22src/test/resources/retest/%22%0A%09%09%09%09%09%09
+%0A%09%09%09%09%09%09WORKSPACE_DEFAULT 
 + Sy
@@ -617,33 +617,41 @@
 FOLDER_DEFAULT )
- 
+%0A%09%09%09%09%09%09%09%09
 + File.separator
@@ -642,39 +642,33 @@
 + File.separator
-%0A%09%09%09%09%09%09
+ 
 + baseName + ext

Extract WORKSPACE_DEFAULT