-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataTest.java
More file actions
57 lines (43 loc) · 1.37 KB
/
DataTest.java
File metadata and controls
57 lines (43 loc) · 1.37 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
package cas2xb3.greenlightTests;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import cas2xb3.greenlight.Collision;
import cas2xb3.greenlight.Data;
public class DataTest {
private static Collision[] crashArr;
private static int numOfCollisions;
@Before
public void setUp() throws Exception {
crashArr = Data.getArray();
numOfCollisions = Data.getCollisionCount();
}
@After
public void tearDown() throws Exception {
crashArr = null;
numOfCollisions = 0;
}
@Test
// Confirms that the crash array is not empty
public void getArrayTest() {
assertTrue(crashArr != null);
}
@Test
// Confirms that the first crash in the array matches the Crash_Data dataset.
public void getArrayTest2() {
Collision firstCrash = crashArr[0];
assertTrue(firstCrash.getLat()== 41.56093317800003 && firstCrash.getLng() == -93.60691740599998);
}
@Test
// Confirms that the last crash in the array matches the Crash_Data dataset.
public void getArrayTest3() {
Collision lastCrash = crashArr[numOfCollisions-1];
assertTrue(lastCrash.getLat()== 42.034764093000035 && lastCrash.getLng() == -91.67532881299996);
}
@Test
// Confirms that the number of crashes determined is correct
public void getCollisionCountTest() {
assertTrue(numOfCollisions == 80673);
}
}