Addressed review comments

This commit is contained in:
npathai
2018-10-21 17:19:41 +05:30
parent 70b4931ab8
commit 10179007e8
4 changed files with 16 additions and 25 deletions

View File

@@ -44,22 +44,24 @@ public class DataMapperTest {
final StudentDataMapper mapper = new StudentDataMapperImpl();
/* Create new student */
Student student = new Student(1, "Adam", 'A');
int studentId = 1;
Student student = new Student(studentId, "Adam", 'A');
/* Add student in respectibe db */
mapper.insert(student);
/* Check if student is added in db */
assertEquals(student.getStudentId(), mapper.find(student.getStudentId()).get().getStudentId());
assertEquals(studentId, mapper.find(student.getStudentId()).get().getStudentId());
/* Update existing student object */
student = new Student(student.getStudentId(), "AdamUpdated", 'A');
String updatedName = "AdamUpdated";
student = new Student(student.getStudentId(), updatedName, 'A');
/* Update student in respectibe db */
mapper.update(student);
/* Check if student is updated in db */
assertEquals("AdamUpdated", mapper.find(student.getStudentId()).get().getName());
assertEquals(updatedName, mapper.find(student.getStudentId()).get().getName());
/* Delete student in db */
mapper.delete(student);