-
Notifications
You must be signed in to change notification settings - Fork 0
/
StudentsTest.java
77 lines (71 loc) · 2.52 KB
/
StudentsTest.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import java.util.ArrayList;
import java.util.UUID;
//Tested by Christian Rios
//Note that these tests may come up with an error when testing from the entire directory, but will work when tested individually.
class StudentsTest {
@BeforeEach
public void setup() {
//runs before each test
UUID id = UUID.fromString("934e9322-fe0c-4368-a182-83eb2fa4d8e9");
String email = "[email protected]";
String username = "abc";
String password = "123";
String number = "456-345-4567";
String firstName = "Jerry";
String lastName = "Seinfeld";
Double gpa = 3.2;
String grade = "Junior";
ArrayList<String> skills = new ArrayList<String>();
skills.add("Acting");
ArrayList<String> awards = new ArrayList<String>();
awards.add("Emmy");
ArrayList<String> extracurriculars = new ArrayList<String>();
extracurriculars.add("Movies");
ArrayList<String> references = new ArrayList<String>();
references.add("ABC");
ArrayList<String> experience = new ArrayList<String>();
references.add("NBC");
Students.addStudent(id, username, password, email, number, firstName, lastName, gpa, grade, skills, awards, extracurriculars, references, experience);
}
@AfterEach
public void tearDown() {
//runs after each test
}
//assertEquals(val1,val2)
//assertFalse(val)
//assertTrue(val)
//assertSame(val1,val2)
//assertNotSame(val1,val2)
//assertNull(val)
//assertNotNull(val)
//This test works, but comes up with an error if you test the entire directory at once.
@Test
public void testAddingStudent() {
ArrayList<Student> studentList = Students.getStudent();
assertNotNull(studentList);
}
@Test
public void testGetStudentThatExists() {
Student student = Students.getStudent("abc");
assertNotNull(student);
}
@Test
public void testGetStudentThatDoesNotExist() {
Student student = Students.getStudent("notinlist");
assertNull(student);
}
@Test
public void testHaveStudentThatExists() {
Boolean have = Students.haveStudent("abc");
assertTrue(have);
}
@Test
public void testHaveStudentThatDoesNotExist() {
Boolean have = Students.haveStudent("notinlist");
assertFalse(have);
}
}