- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestSimpleStudentRepository.java
More file actions
Latest commit
39 lines (32 loc) · 1.03 KB
/
Copy pathTestSimpleStudentRepository.java
File metadata and controls
39 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
packagestudentmanagement;
importorg.junit.Assert;
importorg.junit.Before;
importorg.junit.Test;
publicclassTestSimpleStudentRepository {
SimpleStudentRepositoryrepo;
Studentstudent;
@Before
publicvoidsetUp(){
repo=newSimpleStudentRepository();
student=newStudent(12236, "John","Nash","Princetown,New Jersey", 3, 4.2);
repo.saveStudent(student);
}
@Test
publicvoidtestSaveAndFind(){
Studenttemp=repo.findStudent(12236);
Assert.assertEquals("Test save and find methods",student,temp);
}
@Test
publicvoidtestDelete(){
repo.deleteStudent(12236);
Studenttemp=repo.findStudent(12236);
Assert.assertEquals("Test delete method",null,temp);
}
@Test
publicvoidtestUpdate(){
Studentstud=newStudent(12236, "John","Nash","New York", 3, 4.2);
repo.upadateStudent(stud);
Studenttemp=repo.findStudent(12236);
Assert.assertEquals("Test update method","New York",temp.getAddress());
}
}