Package org.junithelper.core.generator

Examples of org.junithelper.core.generator.TestCaseGenerator


                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.version3);
            } else {
                testCodeString = testCaseGenerator.getNewTestCaseSourceCode();
            }
            testCodeString = standardizeLineBreak(config, testCodeString);
            FileWriterFactory.create(testFile).writeText(testCodeString);
            Stdout.p("  Forced JUnit 3.x: " + testFile.getAbsolutePath());
        }
View Full Code Here


                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
                        .getTestCaseSourceCodeWithLackingTestMethod(currentTestCaseSourceCode);
                if (!testCodeString.equals(currentTestCaseSourceCode)) {
                    testCodeString = standardizeLineBreak(config, testCodeString);
                    FileWriterFactory.create(testFile).writeText(testCodeString);
                    Stdout.p("  Modified: " + testFile.getAbsolutePath());
                }
            } else {
                testCodeString = testCaseGenerator.getNewTestCaseSourceCode();
                FileWriterFactory.create(testFile).writeText(testCodeString);
                Stdout.p("  Created: " + testFile.getAbsolutePath());
            }
        }
View Full Code Here

TOP

Related Classes of org.junithelper.core.generator.TestCaseGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.