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 55import org .junit .jupiter .api .BeforeEach ;
66import org .junit .jupiter .api .Test ;
77
8-
9-
10-
118class Lesson15Test {
129
1310 private EmployeeManager manager ;
1411 private Employee emp ;
1512
1613 @ BeforeEach
17- public void conStant () {
14+ public void setUp () {
1815 manager = new EmployeeManager ();
19- emp = new Employee (1 , "Kimberlee Haldane" , null , 0 );
16+ emp = new Employee (1 , "Edgar Allen Poe" );
2017 }
21-
18+
2219 @ Test
23- public void testAddEmployee () {
24- // Act
25- manager .addEmployee (emp );
20+ public void testAddEmployee () {
21+ // Act
22+ manager .addEmployee (emp );
2623 // 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+ }
3027
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+ }
3139}
32-
You can’t perform that action at this time.
0 commit comments