亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

和老師的一樣,這段代碼能運行,但是測試結果是錯誤的

import static org.junit.jupiter.api.Assertions.*;


import java.util.Arrays;

import java.util.Collection;

import org.junit.jupiter.api.Test;

import org.junit.runner.RunWith;

import org.junit.runners.Parameterized;

import org.junit.runners.Parameterized.Parameters;


@RunWith(Parameterized.class)

class ParameterTest {

int expected = 0;

int input1 = 0;

int input2 = 0;


@Parameters

public static Collection<Object[]> t() {

return Arrays.asList(new Object[][] { { 3, 1, 2 }, { 4, 2, 2 } });

}


public ParameterTest(int expected, int input1, int input2) {

this.expected = expected;

this.input1 = input1;

this.input2 = input2;

}


@Test

public void testAdd() {

assertEquals(expected, new Calculate().add(input1, input2));

}


}


正在回答

4 回答

因為你用的junit5,junit5里面沒有參數解析器

0 回復 有任何疑惑可以回復我~

有人知道什么錯誤了嗎?


0 回復 有任何疑惑可以回復我~

我的也是不能運行

Errors:

org.junit.jupiter.api.extension.ParameterResolutionException: No ParameterResolver registered for parameter [int arg0] in executable [public com.CalculateTest.ParameteriTest(int,int,int)].

2 回復 有任何疑惑可以回復我~
#1

慕容2016289

知道為什么錯了嗎???我也遇到這個問題了。。。。求解答
2019-11-17 回復 有任何疑惑可以回復我~

public class ParameterTest {}


????

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

和老師的一樣,這段代碼能運行,但是測試結果是錯誤的

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號