简体   繁体   中英

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. 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.

use assertEquals(double expected, double actual, double delta) instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM