Ниже приведен мой простой код
package M06;
public class ExerciseE03 {
public double calcTotal (double total, boolean existingMember, boolean validDiscount, boolean validCoupon) {
double discount=0.0;
if (existingMember && validDiscount || validCoupon) {
if (total > 1_000.0)
discount = 0.15;
else
if (total >= 750)
discount = 0.1;
else
if (total > 500)
discount = 0.05;
else
discount = 0.025;
}
return (total * (1-discount) * 1.0825);
}
}
, а это j-й файл
package M06;
import static org.junit.Assert.*;
import static junitparams.JUnitParamsRunner.$;
import org.junit.Before;
import org.junit.Test;
import junitparams.FileParameters;
public class ExerciseE03Test {
private ExerciseE03 object;
@Before
public void setUp() throws Exception {
object = new ExerciseE03();
}
@Test
@FileParameters("src/M06/E03TestCaseTable.csv")
public void test(int testcaseNumber, boolean member, boolean disc, boolean coupon, double total, double discount, double output) {
//ExerciseE03 object = new ExerciseE03();
//assertEquals(1380.1875, object.calcTotal(1500, true, true, true),0.001);
object.calcTotal( total, member, disc, coupon);
assertEquals(output,object.calcTotal(total, member, disc, coupon),0.01);
}
}
Я также предоставляю свой скриншот junit ниже. Поскольку я новичок в Juint, я не знаю, какие шаги необходимо предпринять для этого типа ошибки
![enter image description here](https://i.stack.imgur.com/EPBCG.png)
Выше приведена ошибка, которую я можно увидеть в моей вкладке джунит ниже.