-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentIDTest.java
60 lines (47 loc) · 1.31 KB
/
StudentIDTest.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
package com.B5015845.CSC8002.Coursework.Testing;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Test;
import com.B5015845.CSC8002.Coursework.StudentFactory;
import com.B5015845.CSC8002.Coursework.StudentID;
/**
* This test class is StudentIDTest, designed to test the ability to store and retrieve studentIDs.
* @author Arianna Esposito
*/
public class StudentIDTest {
StudentID sid = StudentID.getInstance();
/*
* As the letter generated is random, tests that it is not null.
*/
@Test
public void testGetLetter()
{
assertNotNull(sid.getLetter());
}
/*
* As the numbers generated are random, tests that random number is within limits of method (4 digit integer).
*/
@Test
public void testGetFourDigit()
{
assertNotNull(sid.getFourDigit());
assertTrue(sid.getFourDigit() > 0000 && sid.getFourDigit() < 9999 );
}
@Test
public void testToString()
{
System.out.println(sid.toString());
}
@Test
public void testGetInstance()
{
assertTrue(sid instanceof StudentID);
}
@After
public void tearDown() {
StudentFactory.getUGs().clear();
StudentFactory.getPGTs().clear();
StudentFactory.getPGRs().clear();
}
}