Repository navigation
Expand file tree
/
Copy pathSchoolTest.java
More file actions
90 lines (78 loc) · 2.64 KB
/
Copy pathSchoolTest.java
File metadata and controls
90 lines (78 loc) · 2.64 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.List;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
public class SchoolTest {
private School school;
@Before
public void setUp() {
school = new School();
}
@Test
public void addingAStudentAddsThemToTheSortedRoster() {
school = new School();
school.add("Aimee", 2);
List<String> expected = Arrays.asList("Aimee");
assertEquals(expected, school.roster());
}
@Ignore("Remove to run test")
@Test
public void addingMoreStudentsAddsThemToTheSameSortedRoster() {
school = new School();
int grade = 2;
school.add("Blair", grade);
school.add("James", grade);
school.add("Paul", grade);
List<String> expected = Arrays.asList("Blair", "James", "Paul");
assertEquals(expected, school.roster());
}
@Ignore("Remove to run test")
@Test
public void addingStudentsToDifferentGradesAddsThemToTheSameSortedRoster() {
school = new School();
school.add("Chelsea", 3);
school.add("Logan", 7);
List<String> expected = Arrays.asList("Chelsea", "Logan");
assertEquals(expected, school.roster());
}
@Ignore("Remove to run test")
@Test
public void rosterReturnsAnEmptyListIfThereAreNoStudentsEnrolled() {
school = new School();
List<String> expected = Arrays.asList();
assertEquals(expected, school.roster());
}
@Ignore("Remove to run test")
@Test
public void studentNamesWithGradesAreDisplayedInTheSameSortedRoster() {
school = new School();
school.add("Peter", 2);
school.add("Anna", 1);
school.add("Barb", 1);
school.add("Zoe", 2);
school.add("Alex", 2);
school.add("Jim", 3);
school.add("Charlie", 1);
List<String> expected = Arrays.asList("Anna", "Barb", "Charlie", "Alex", "Peter", "Zoe", "Jim");
assertEquals(expected, school.roster());
}
@Ignore("Remove to run test")
@Test
public void gradeReturnsTheStudentsInThatGradeInAlphabeticalOrder() {
school = new School();
school.add("Franklin", 5);
school.add("Bradley", 5);
school.add("Jeff", 1);
List<String> expected = Arrays.asList("Bradley", "Franklin");
assertEquals(expected, school.grade(5));
}
@Ignore("Remove to run test")
@Test
public void gradeReturnsAnEmptyListIfThereAreNoStudentsInThatGrade() {
school = new School();
List<String> expected = Arrays.asList();
assertEquals(expected, school.grade(1));
}
}