0
매개 변수 테스트 클래스가 있고 IllegalArgumentException을 반환 할 것으로 예상되는 테스트 메서드가 있습니다.매개 변수화 된 테스트 클래스의 IllegalArgumentException
는 모든 솔루션을 사람이 있습니다 .. 방법 negetiveSideTest 일치 찾을 수 없습니다 테스트 : 초기화 오류 :
@RunWith(value = Parameterized.class)
public class TriangleParametrizedTest {
@Rule
public ExpectedException exception = ExpectedException.none();
enum Type {
EQUILATERAL,
NEGETIVE
};
private Type type;
private int sideA;
private int sideB;
private int sideC;
public TriangleParametrizedTest(Type type, int sideA, int sideB, int sideC) {
this.type = type;
this.sideA = sideA;
this.sideB = sideB;
this.sideC = sideC;
}
@Parameters()
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{Type.EQUILATERAL, 5, 5, 5},
{Type.NEGETIVE, -5, 5, 5},});
}
@Test()
public void negetiveSideTest() {
Assume.assumeTrue(type == Type.NEGETIVE);
exception.expect(IllegalArgumentException.class);
Triangle trianle = new Triangle(sideA, sideB, sideC);
}
}
하지만 난이 오류를 가지고있다? 당신이 당신의 테스트 기능을 표시하기 위해 @Test 주석을 사용하는 경우