-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCost2.java
More file actions
31 lines (26 loc) · 769 Bytes
/
TestCost2.java
File metadata and controls
31 lines (26 loc) · 769 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
package carpoolTestCode;
import code.Cost2;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class TestCost2 {
private Cost2 cost;
@BeforeEach
void setUp() throws Exception {
Cost2.resetCostCounter();
cost = new Cost2("Toll", 3.01);
}
@Test
void TestCannotSetCostLessThan0Dollars() {
assertThrows(IllegalArgumentException.class, () -> cost.setCost(-3.01));
}
@Test
void TestCostIDIncrementsBy1EachObjectCreated() {
assertEquals(1, cost.getCostID());
}
}