[英]I run this junit test, but it fails what's wrong?
this is my class i want to test if the 0<= amount <25000 then theres no tax.这是我的班级,我想测试 0<= 金额 <25000 是否免税。 but it doesn't work.
但它不起作用。 the test fails.
测试失败。
public class TaxCalculator{
public double calc(double amount){
double pay = amount*0;
return pay;
}
}
my test looks like this.我的测试看起来像这样。 i've imported both Test and Assert.
我已经导入了测试和断言。
public class TaxCalculatorTest{
@Test
public void testCalc(){
assertEquals(0,tax.calc(1));
assertEquals(double expected, double actual)
is deprecated and ALWAYS fails. assertEquals(double expected, double actual)
被弃用并且总是失败。
use assertEquals(double expected, double actual, double delta)
instead使用
assertEquals(double expected, double actual, double delta)
代替
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.