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/recheck" + 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/recheck" + File.separator + baseName + "." + extension );
			}
		};
	}

	@Override
	public String getTestClassName() {
		// TODO Use Approval API here instead... and remove duplicated class TestCaseFinder afterwards
		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() {
		// TODO Use Approval API here instead... and remove duplicated class TestCaseFinder afterwards
		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!" );
	}
}

@@ -848,105 +848,8 @@
 ) %7B%0A
-%09%09// TODO Use Approval API here instead... and remove duplicated class TestCaseFinder afterwards%0A
 %09%09fi
@@ -1208,105 +1208,8 @@
 ) %7B%0A
-%09%09// TODO Use Approval API here instead... and remove duplicated class TestCaseFinder afterwards%0A
 %09%09fi

Remove TODOs