-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestStudentMaxMark.java
55 lines (47 loc) · 1.32 KB
/
TestStudentMaxMark.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
import org.junit.Test;
import org.junit.experimental.categories.Category;
import static org.junit.Assert.*;
public class TestStudentMaxMark {
@Test
public void testRight() {
int[] marks= {10, 6, 9, 8};
Student s= new Student("Gigel", 20,
marks, EFaculty.CSIE);
int actualValue= s.maxMark();
int expectedValue=10;
assertEquals("test normal set of marks", expectedValue, actualValue);
}
@Category(SlowTest.class)
@Test
public void testCrossCheck() {
int[] marks= {10, 6, 9, 8};
Student s= new Student("Gigel", 20,
marks, EFaculty.CSIE);
int actualValue= s.maxMark();
int expectedValue=s.maxMark2();
assertEquals("test normal set of marks", expectedValue, actualValue);
}
@Test
public void testInverseRelationship() {
int[] marks= {10, 6, 9, 8};
Student s= new Student("Gigel", 20,
marks, EFaculty.CSIE);
int actualValue = s.maxMark();
for(int i=0; i<marks.length; i++) {
if(marks[i]==actualValue)
i++;
assertNotEquals(marks[i], actualValue);
}
}
@Test
public void testPerformance1() {
int[] marks= {10, 6, 9, 8};
Student s= new Student("Gigel", 20,
marks, EFaculty.CSIE);
long startTime=System.currentTimeMillis();
s.maxMark();
long endTime= System.currentTimeMillis();
long maxTime=5;
assertTrue(maxTime>=endTime-startTime);
}
}