I run this junit test, but it fails what's wrong?

Johnny Van :

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));
Bor Laze :

assertEquals(double expected, double actual) is deprecated and ALWAYS fails.

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=161115&siteId=1