forked from mscanlan24/CIS3374-JUnit-Lab2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFareCalculatorTestEXAMPLEKEY.java
More file actions
43 lines (33 loc) · 989 Bytes
/
FareCalculatorTestEXAMPLEKEY.java
File metadata and controls
43 lines (33 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.lab2.transit;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class FareCalculatorTest {
private static final double DELTA = 1e-15;
private double expected;
private int age;
private String time;
private boolean isHoliday;
public FareCalculatorTest(double expected, int age, String time, boolean isHoliday) { //This is the constructor
this.expected = expected;
this.age = age;
this.time = time;
this.isHoliday = isHoliday;
}
@Parameters
public static Collection<Object[]> testParams() {
return Arrays.asList(new Object[][] {
{0.0, 4, "6:00", false},
{2.5, 6, "20:00", false}
});
}
@Test
public void calculateFareTest() {
assertEquals(expected, FareCalculator.calculateFare(age, time, isHoliday), DELTA);
}
}