-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathStudentTest.java
More file actions
93 lines (72 loc) · 2.64 KB
/
StudentTest.java
File metadata and controls
93 lines (72 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
91
92
93
package io.zipcoder;
import org.junit.Assert;
import org.junit.Test;
public class StudentTest {
@Test
public void testGetFirstName() {
String firstName = "Rex";
String lastName = "Casio";
Double[] testScores = {70.0, 80.0, 90.0};
Student student = new Student(firstName,lastName,testScores);
//student.setFirstName();
String actual = student.getFirstName();
Assert.assertEquals(firstName, actual);
}
@Test
public void testGetLastName() {
String firstName = "Rex";
String lastName = "Casio";
Double[] examScores = {70.0, 80.0, 90.0};
Student student = new Student(firstName,lastName,examScores);
String actual = student.getLastName();
Assert.assertEquals(firstName, actual);
}
@Test
public void testGetFullName() {
String firstName = "Rex";
String lastName = "Casio";
Double[] examScores = {70.0, 80.0, 90.0};
Student student = new Student(firstName,lastName,examScores);
String expected = "Rex Casio";
String actual = student.getFirstName() + " " +student.getLastName();
Assert.assertEquals(expected, actual);
}
@Test
public void TestGetExamsScores() {
String firstName = "Rex";
String lastName = "Casio";
Double[] examScores = {70.0, 80.0, 90.0};
Student student = new Student(firstName,lastName,examScores);
String expected = "Exam Scores: \n" +
"\tExam 1 -> 70.0\n" +
"\tExam 2 -> 80.0\n" +
"\tExam 3 -> 90.0\n";
String actual = student.getExamScores();
Assert.assertEquals(expected, actual);
}
@Test
public void TestGetAverageExamScore() {
String firstName = "Rex";
String lastName = "Casio";
Double[] examScores = {70.0, 80.0, 90.0};
Student student = new Student(firstName, lastName, examScores);
Double expected = 80.0;
Double actual = student.getAverageExamScore();
Assert.assertEquals(expected, actual);
}
@Test
public void TestStringOverride() {
String firstName = "Rex";
String lastName = "Casio";
Double[] examScores = {70.0, 80.0, 90.0};
Student student = new Student(firstName, lastName, examScores);
String expected = "Student Name: Rex Casio\n" +
"> Average Score: 80.0\n" +
"> Exam Scores: \n" +
"\tExam 1 -> 70.0\n" +
"\tExam 2 -> 80.0\n" +
"\tExam 3 -> 90.0\n";
String actual = student.toString();
Assert.assertEquals(expected, actual);
}
}