Skip to content

Commit 2ef91ac

Browse files
author
AmiyahJo
committed
feat: adds test
fix: comment out code in employeeManager Test
1 parent f281ac0 commit 2ef91ac

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

lesson_15/tdd/tdd_app/src/main/java/com/codedifferently/lesson15/Employee.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void setSalary(double salary) {
4747
}
4848

4949
public String getDetails(){
50-
return "The employee, " +name+ " in " +department+ " with the ID of " +id+ " has a salary of " +salary+ " .";
50+
return "Employee: " + name + ", Department: " + department + " , ID: " +id+ " , Salary: " + (int)salary;
5151
}
5252

5353
}

lesson_15/tdd/tdd_app/src/test/java/com/codedifferently/lesson15/EmployeeManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class EmployeeManagerTest {
66
@Test
77
void testAddEmployee() {
88
//employees.put(employee.getId(), employee);
9-
var newEmployee = new employees.put(employee.getId(), employee);
9+
// var newEmployee = new employees.put(employee.getId(), employee);
1010
}
1111

1212
@Test
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.codedifferently.lesson15;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
6+
public class EmployeeTest {
7+
@Test
8+
void testGetDepartment() {
9+
10+
}
11+
12+
@Test
13+
void testGetDetails() {
14+
//Arrange
15+
Employee employee = new Employee(12345, "John Doe", "Engineering", 75000);
16+
//Act
17+
String actualDetails = employee.getDetails();
18+
//Assert
19+
String expectedDetails = "Employee: John Doe, Department: Engineering , ID: 12345 , Salary: 75000";
20+
assertEquals(expectedDetails, actualDetails);
21+
}
22+
23+
@Test
24+
void testGetId() {
25+
26+
}
27+
28+
@Test
29+
void testGetName() {
30+
31+
}
32+
33+
@Test
34+
void testGetSalary() {
35+
36+
}
37+
38+
@Test
39+
void testSetDepartment() {
40+
41+
}
42+
43+
@Test
44+
void testSetId() {
45+
46+
}
47+
48+
@Test
49+
void testSetName() {
50+
51+
}
52+
53+
@Test
54+
void testSetSalary() {
55+
56+
}
57+
}

0 commit comments

Comments
 (0)