-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathClassroomTest.java
More file actions
48 lines (38 loc) · 1.44 KB
/
ClassroomTest.java
File metadata and controls
48 lines (38 loc) · 1.44 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
package io.zipcoder;
import org.junit.Test;
import java.util.Arrays;
public class ClassroomTest {
@Test
public void avgExamScoreTest(){
// : Given
Double[] s1Scores = { 100.0, 150.0 };
Double[] s2Scores = { 225.0, 25.0 };
Student s1 = new Student("student", "one", s1Scores);
Student s2 = new Student("student", "two", s2Scores);
Student[] students = {s1,s2};
Classroom classroom = new Classroom(students);
// When
double output = classroom.getAverageExamScore();
// Then
System.out.println(output);
}
@Test
public void addStudentTest(){
// : Given
int maxNumberOfStudents = 1;
Classroom classroom = new Classroom(maxNumberOfStudents);
Double[] examScores = { 100.0, 150.0, 250.0, 0.0 };
Student student = new Student("Leon", "Hunter", examScores);
// When
Student[] preEnrollment = classroom.getStudents();
classroom.addStudent(student);
Student[] postEnrollment = classroom.getStudents();
// Then
String preEnrollmentAsString = Arrays.toString(preEnrollment);
String postEnrollmentAsString = Arrays.toString(postEnrollment);
System.out.println("===========================");
System.out.println(preEnrollmentAsString);
System.out.println("===========================");
System.out.println(postEnrollmentAsString);
}
}