2
2
3
3
import static org .assertj .core .api .Assertions .assertThat ;
4
4
import static org .junit .jupiter .api .Assertions .assertEquals ;
5
+
5
6
import org .junit .jupiter .api .Test ;
6
7
7
8
class Lesson15Test {
@@ -18,52 +19,58 @@ public void testGetGreeting() {
18
19
}
19
20
20
21
@ Test
21
- public void testEmployeeId_Exists (){
22
+ public void testEmployeeId_Exists () {
22
23
Employee employee = new Employee (0 , null , null , 0 );
23
24
assertEquals (0 , employee .getId ());
24
25
}
25
26
26
27
@ Test
27
- public void testEmployeeName_Exists (){
28
+ public void testEmployeeName_Exists () {
28
29
Employee employee = new Employee (0 , "dave" , null , 0 );
29
30
assertEquals ("dave" , employee .getName ());
30
31
}
31
- @ Test
32
- public void testEmployeeDepartment_Exists (){
32
+
33
+ @ Test
34
+ public void testEmployeeDepartment_Exists () {
33
35
Employee employee = new Employee (0 , "dave" , "IT" , 0 );
34
36
assertEquals ("IT" , employee .getDepartment ());
35
37
}
38
+
36
39
@ Test
37
- public void testEmployeeSalary_Exists (){
40
+ public void testEmployeeSalary_Exists () {
38
41
Employee employee = new Employee (0 , "dave" , "IT" , 10000 );
39
42
assertEquals (10000 , employee .getSalary ());
40
43
}
44
+
41
45
@ Test
42
- public void testGetEmployee (){
46
+ public void testGetEmployee () {
43
47
Employee employee = new Employee (10 , null , null , 0 );
44
48
EmployeeManager manager = new EmployeeManager ();
45
49
manager .addEmployee (employee );
46
50
assertEquals (employee , manager .getEmployee (10 ));
47
51
}
52
+
48
53
@ Test
49
- public void testGetEmployeeCount (){
54
+ public void testGetEmployeeCount () {
50
55
Employee employee = new Employee (10 , null , null , 0 );
51
56
EmployeeManager manager = new EmployeeManager ();
52
57
manager .addEmployee (employee );
53
58
assertEquals (1 , manager .getEmployeeCount ());
54
- }
55
- @ Test
56
- public void testGetEmployeeUpate (){
59
+ }
60
+
61
+ @ Test
62
+ public void testGetEmployeeUpate () {
57
63
Employee employee2 = new Employee (10 , "BillyBobJenkins" , null , 0 );
58
64
Employee employee = new Employee (10 , "Dave" , null , 0 );
59
65
EmployeeManager manager = new EmployeeManager ();
60
66
manager .addEmployee (employee );
61
67
manager .updateEmployee (employee2 );
62
68
63
69
assertEquals (employee2 , manager .getEmployee (10 ));
64
- }
65
- @ Test
66
- public void testGetEmployeeRemove (){
70
+ }
71
+
72
+ @ Test
73
+ public void testGetEmployeeRemove () {
67
74
Employee employee2 = new Employee (10 , "BillyBobJenkins" , null , 0 );
68
75
Employee employee = new Employee (11 , "Dave" , null , 0 );
69
76
EmployeeManager manager = new EmployeeManager ();
@@ -72,11 +79,12 @@ public void testGetEmployeeRemove(){
72
79
manager .removeEmployee (10 );
73
80
74
81
assertEquals (1 , manager .getEmployeeCount ());
75
- }
82
+ }
83
+
76
84
@ Test
77
- public void testGetDetails (){
85
+ public void testGetDetails () {
78
86
Employee employee2 = new Employee (10 , "BillyBobJenkins" , "IT" , 10 );
79
- assertEquals ("ID: 10, Name: BillyBobJenkins, Department: IT, Salary: 10.0" , employee2 . getDetails ());
80
-
87
+ assertEquals (
88
+ "ID: 10, Name: BillyBobJenkins, Department: IT, Salary: 10.0" , employee2 . getDetails ());
81
89
}
82
- }
90
+ }
0 commit comments