if (confirmToExecute() > 0) {
return;
}
// Execute re-writing tests
FileReader fileReader = FileReaderFactory.create();
for (File javaFile : javaFiles) {
File testFile = null;
String currentTestCaseSourceCode = null;
try {
String testFilePath = javaFile.getAbsolutePath().replaceAll("\\\\", "/").replaceFirst(
getDirectoryPathOfProductSourceCode(config), getDirectoryPathOfTestSourceCode(config))
.replaceFirst("\\.java", "Test.java");
testFile = new File(testFilePath);
currentTestCaseSourceCode = fileReader.readAsString(testFile);
} catch (Exception e) {
}
CurrentLineBreak currentLineBreak = CurrentLineBreakDetector.detect(currentTestCaseSourceCode);
LineBreakProvider lineBreakProvider = new LineBreakProvider(config, currentLineBreak);
TestCaseGenerator testCaseGenerator = TestCaseGeneratorFactory.create(config, lineBreakProvider);
String targetSourceCodeString = fileReader.readAsString(javaFile);
testCaseGenerator.initialize(targetSourceCodeString);
String testCodeString = null;
if (currentTestCaseSourceCode != null) {
testCodeString = testCaseGenerator.getUnifiedVersionTestCaseSourceCode(testCaseGenerator
.getTestCaseSourceCodeWithLackingTestMethod(currentTestCaseSourceCode), JUnitVersion.version4);