Junit参数化设置报错
package com.imooc.junit;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Collections;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class ParameterTest {
int expection = 0;
int input01 = 0;
int input02 = 0;
@Parameters
public static Collections<Object[]> t() {
return Arrays.asList(new Object[][]{
{3,1,2},
{4,2,2}
}) ;
}
public ParameterTest(int expenction,int input01,int input02){
this.expection = expenction;
this.input01 = input01;
this.input02 = input02;
}
public void testAdd(){
assertEquals(expection, new Calculate().add(input01, input02));
}
}
同样的代码,Collection不加上s反而报错更多,小新人不了解,是不是有什么版本问题?(我一模一样的敲,试过把老师的代码复制过来,也是报错)
说是类型无法转换。。。?
The type Collections is not generic; it cannot be parameterized with arguments <Object[]>