|
1 |
| -import java.util.HashMap; |
2 |
| -import java.util.Map; |
3 |
| - |
4 | 1 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
5 |
| -import org.junit.jupiter.api.BeforeEach; |
6 |
| -import org.junit.jupiter.api.Test; |
7 | 2 |
|
8 | 3 | import com.codedifferently.lesson15.Employee;
|
9 | 4 | import com.codedifferently.lesson15.EmployeeManager;
|
| 5 | +import java.util.HashMap; |
| 6 | +import java.util.Map; |
| 7 | +import org.junit.jupiter.api.BeforeEach; |
| 8 | +import org.junit.jupiter.api.Test; |
10 | 9 |
|
11 | 10 | public class EmployeeManagerTest {
|
12 | 11 | Employee employee;
|
@@ -42,47 +41,45 @@ void testUpdateEmployee() {
|
42 | 41 | employees.put(employee.getId(), employee);
|
43 | 42 |
|
44 | 43 | employeeNew = new Employee(15, "Paul", "President", 200);
|
45 |
| - |
| 44 | + |
46 | 45 | employees.put(employeeNew.getId(), employeeNew);
|
47 |
| - |
| 46 | + |
48 | 47 | employeeManager.addEmployee(employee);
|
49 |
| - |
| 48 | + |
50 | 49 | employeeManager.updateEmployee(employeeNew);
|
51 |
| - |
| 50 | + |
52 | 51 | assertEquals(
|
53 | 52 | employeeManager.getEmployee(employeeNew.getId()), employees.get(employeeNew.getId()));
|
54 | 53 | }
|
55 | 54 |
|
56 | 55 | @Test
|
57 | 56 | void testRemoveEmployee() {
|
58 | 57 | employees.put(employee.getId(), employee);
|
59 |
| - |
| 58 | + |
60 | 59 | employees.remove(employee.getId(), employee);
|
61 |
| - |
| 60 | + |
62 | 61 | employeeManager.addEmployee(employee);
|
63 |
| - |
| 62 | + |
64 | 63 | employeeManager.removeEmployee(employee.getId());
|
65 |
| - |
| 64 | + |
66 | 65 | assertEquals(0, employeeManager.getEmployeeCount());
|
67 | 66 | }
|
68 | 67 |
|
69 | 68 | @Test
|
70 |
| - void testAssertEmployeeInCollection() throws IllegalArgumentException { |
71 |
| - |
72 |
| - } |
| 69 | + void testAssertEmployeeInCollection() throws IllegalArgumentException {} |
73 | 70 |
|
74 | 71 | @Test
|
75 | 72 | void testGetEmployeeCount() {
|
76 | 73 | employees.put(employee.getId(), employee);
|
77 |
| - |
| 74 | + |
78 | 75 | employeeNew = new Employee(16, "Paul", "President", 200);
|
79 |
| - |
| 76 | + |
80 | 77 | employees.put(employeeNew.getId(), employeeNew);
|
81 |
| - |
| 78 | + |
82 | 79 | employeeManager.addEmployee(employee);
|
83 |
| - |
| 80 | + |
84 | 81 | employeeManager.addEmployee(employeeNew);
|
85 |
| - |
| 82 | + |
86 | 83 | assertEquals(2, employeeManager.getEmployeeCount());
|
87 | 84 | }
|
88 | 85 | }
|
0 commit comments