File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed
lesson_15/tdd/tdd_app/src/test/java/com/codedifferently/lesson15 Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change 5
5
import org .junit .jupiter .api .BeforeEach ;
6
6
import org .junit .jupiter .api .Test ;
7
7
8
-
9
-
10
-
11
8
class Lesson15Test {
12
9
13
10
private EmployeeManager manager ;
14
11
private Employee emp ;
15
12
16
13
@ BeforeEach
17
- public void conStant () {
14
+ public void setUp () {
18
15
manager = new EmployeeManager ();
19
- emp = new Employee (1 , "Kimberlee Haldane" , null , 0 );
16
+ emp = new Employee (1 , "Edgar Allen Poe" );
20
17
}
21
-
18
+
22
19
@ Test
23
- public void testAddEmployee () {
24
- // Act
25
- manager .addEmployee (emp );
20
+ public void testAddEmployee () {
21
+ // Act
22
+ manager .addEmployee (emp );
26
23
// Assert
27
- assertEquals (1 , manager .getEmployeeCount ());
28
- assertEquals (emp , manager .getEmployee (1 ));
29
- }
24
+ assertEquals (1 , manager .getEmployeeCount ());
25
+ assertEquals (emp , manager .getEmployee (1 ));
26
+ }
30
27
28
+ @ Test
29
+ public void testGetEmployee () {
30
+ // Arrange
31
+ int key = 1 ;
32
+ Employee expectedValue = new Employee (1 , "Edgar Allen Poe" );
33
+ manager .addEmployee (expectedValue );
34
+ // Act
35
+ Employee actualValue = manager .getEmployee (key );
36
+ // Assert
37
+ assertEquals (expectedValue , actualValue , "The value retrieved should match the value added." );
38
+ }
31
39
}
32
-
You can’t perform that action at this time.
0 commit comments