在junit 4.13中使用Parameterized.Parameter

问题描述

我在impor中收到“无法解析符号参数”。我必须使用junit 4.13,我认为这段代码将在junit 4.12中工作。我可以进行哪些更改以使以下代码正常工作?

import org.junit.Test;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;

@RunWith(Parameterized.class)
public class MyTest {

    @Parameterized.Parameter(0)
    private String arg1;

    @Parameterized.Parameter(1)
    private long arg2;

    public  MyTest(String arg1,long arg2) {
        this.arg1 = arg1;
        this.arg2 = arg2;
    }

    @Parameterized.Parameters
    public static Collection argPairs() {
        return Arrays.asList(new Object[][] {
                {"using arg1",Long.parseLong(arg1) },{"using arg2",Long.parseLong(arg2) }
        });
    }

    @Test
    public void test1() {
        // stuff
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)