SuiteRewritingStage.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:junit-converter 作者:
/**
 * @see junitconverter.stages.TestConversionStage#convertClass(junitconverter.testcase.TestCaseClass)
 */
public void convertClass(TestCaseClass testCase)
{
    // This is a gigantic hack. We use a regex to search for classes/suites added to the suite.
    // We start our search at the beginning of the suite method
    List<String> lines = testCase.getLines().subList(testCase.getSuiteStartLine(), testCase.getSuiteEndLine() + 1);
    StringBuilder builder = new StringBuilder();
    builder.append('{');
    for (String line : lines)
    {
        Matcher m = p.matcher(line);
        if (m.find())
        {
            String testName = m.group(2);
            builder.append(testName).append(".class, "); //$NON-NLS-1$
        }
    }
    builder.append('}');
    codeEditor.addAnnotation(testCase, SuiteClasses.class, builder.toString());
    codeEditor.addAnnotation(testCase, RunWith.class, "Suite.class"); //$NON-NLS-1$
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号