Skip to content

Commit 7e8fe9e

Browse files
authored
Update CourseServiceUnitTest.java
1 parent c3a10bb commit 7e8fe9e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libraries-apache-commons/src/test/java/com/baeldung/commons/beanutils/CourseServiceUnitTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
public class CourseServiceUnitTest {
1717

18+
private static final String STUDENT_ID = "01";
19+
1820
@Test
1921
public void givenCourse_whenGettingSimplePropertyValueUsingPropertyUtil_thenValueReturned() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
2022
Course course = new Course();
@@ -50,10 +52,10 @@ public void givenCourse_whenGettingMappedPropertyValueUsingPropertyUtil_thenValu
5052
// 1. Create and set a Student
5153
Student student = new Student();
5254
student.setName("John Doe");
53-
CourseService.setMappedValue(course, "ST-1", student);
54-
// Use getMappedProperty to retrieve the value associated with the key 'ST-1'
55+
CourseService.setMappedValue(course, STUDENT_ID, student);
56+
// Use getMappedProperty to retrieve the value associated with the key '01'
5557
// from the 'enrolledStudent' map
56-
Student enrolledStudent = (Student) PropertyUtils.getMappedProperty(course, "enrolledStudent(" + ST-1 + ")");
58+
Student enrolledStudent = (Student) PropertyUtils.getMappedProperty(course, "enrolledStudent(" + STUDENT_ID + ")");
5759

5860
assertEquals("John Doe", enrolledStudent.getName());
5961
}

0 commit comments

Comments
 (0)