第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在運(yùn)行Junit測(cè)試時(shí)修復(fù)assertTrue錯(cuò)誤

如何在運(yùn)行Junit測(cè)試時(shí)修復(fù)assertTrue錯(cuò)誤

猛跑小豬 2019-04-17 18:15:38
設(shè)置Junit測(cè)試但遇到測(cè)試失敗。問(wèn)題似乎與我的assertTrue有關(guān)import static org.junit.Assert.*;import org.junit.Test;import com.neueda.cap.spark.model.NeuFixMessage;import quickfix.Message; public class CalculateFillValue {     @Test     public void test() throws Exception {         CalculateFillValuesMapper test = new CalculateFillValuesMapper();         NeuFixMessage msg= new  NeuFixMessage();         msg.setMsgType("8");         msg.setExecType("1");         msg.setLastPx("10.10");         msg.setLastShares("100");         msg = test.call(msg);         assertTrue("The  file value should be 1010", msg.getFillValue() == 1010);     }}
查看完整描述

2 回答

?
鳳凰求蠱

TA貢獻(xiàn)1825條經(jīng)驗(yàn) 獲得超4個(gè)贊

使用assertTrue或assertequals是否更好

目前的代碼是

assertEquals(“這是預(yù)期的填充”,msg.getFillValue(),(1010.0));

錯(cuò)誤:方法assertEquals(String,Object,Object)對(duì)于CalculateFillValue類型是不明確的


查看完整回答
反對(duì) 回復(fù) 2019-05-15
?
蕪湖不蕪

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超7個(gè)贊


測(cè)試失敗的唯一原因是getFillValue()返回1010以外的任何內(nèi)容。將輸出打印在assertTrue方法的正上方,您應(yīng)該看到測(cè)試失敗的原因。


System.out.println("Fill Value: " + msg.getFillValue());


boolean testCondition = (msg.getFillValue() == 1010)



System.out.println("testCondition: " + testCondition);


assertTrue("The  file value should be 1010", testCondition);


查看完整回答
反對(duì) 回復(fù) 2019-05-15
  • 2 回答
  • 0 關(guān)注
  • 1197 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)