-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestSimpleStudentRepository.java
39 lines (32 loc) · 1.03 KB
/
TestSimpleStudentRepository.java
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
package studentmanagement;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class TestSimpleStudentRepository {
SimpleStudentRepository repo;
Student student;
@Before
public void setUp(){
repo=new SimpleStudentRepository();
student=new Student(12236, "John","Nash","Princetown,New Jersey", 3, 4.2);
repo.saveStudent(student);
}
@Test
public void testSaveAndFind(){
Student temp=repo.findStudent(12236);
Assert.assertEquals("Test save and find methods",student,temp);
}
@Test
public void testDelete(){
repo.deleteStudent(12236);
Student temp=repo.findStudent(12236);
Assert.assertEquals("Test delete method",null,temp);
}
@Test
public void testUpdate(){
Student stud=new Student(12236, "John","Nash","New York", 3, 4.2);
repo.upadateStudent(stud);
Student temp=repo.findStudent(12236);
Assert.assertEquals("Test update method","New York",temp.getAddress());
}
}