📄 testcartmethod.java~16~
字号:
package junittest;
import junit.framework.*;
import data.*;
public class TestCartMethod extends TestCase {
private CartMethod cartMethod = null;
protected void setUp() throws Exception {
super.setUp();
cartMethod = new CartMethod();
}
protected void tearDown() throws Exception {
cartMethod = null;
super.tearDown();
}
//测试分解分符串的方法
public void testDecodeGoodsStr() {
String goodStr = "糖果@@每箱30盒@@10@@5";
String[] actualReturn = cartMethod.decodeGoodsStr(goodStr);
assertEquals("return value", "每箱30盒", actualReturn[1]);
}
//测试四舍五入的方法,保留2个小数点
public void testRoundUp(){
double num = 16.753;
double actualReturn = cartMethod.roundUp(num)
assertEquals("return value", 16.75, actualReturn);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -