我想運行下面的代碼,並得到錯誤的參數數量錯誤。JunitParamsRunner測試
package Homework7;
import static junitparams.JUnitParamsRunner.$;
import static org.junit.Assert.*;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(JUnitParamsRunner.class)
public class Problem3TestClass {
private Problem3Class p3class;
@SuppressWarnings("unused")
public static final Object[] Problem3TestClass(){
return $(
// Parameters are: (1, 2)
// 1 = x,2 = y
// Test case 1
$(12223,1)
);
}
@Before
public void setUp() {
p3class = new Problem3Class();
}
@Test
@Parameters(method = "Problem3TestClass")
public void test(int[] x,int y)
{
assertEquals(y,p3class.countRepeated(x));
}
}
我countRepeated方法通過以下方式
public int countRepeated (int[] x)
我到底錯在這裏做invocated?