-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTechTypeTest.java
More file actions
34 lines (25 loc) · 943 Bytes
/
TechTypeTest.java
File metadata and controls
34 lines (25 loc) · 943 Bytes
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
package bwapi;
import org.junit.Test;
import java.lang.reflect.*;
import java.util.*;
import static org.junit.Assert.assertEquals;
/**
* Reads all arrays
*/
public class TechTypeTest {
@Test
public void testArraySizes() throws IllegalAccessException {
int expectedSize = 1 + Arrays.stream(TechType.values()).max(Comparator.comparingInt(a -> a.id)).get().id;
for (Field f : TechType.class.getDeclaredFields()) {
if (f.getType().isArray() && !f.getName().startsWith("$") && !f.getName().startsWith("_")) {
f.setAccessible(true);
int size = Array.getLength(f.get(0));
assertEquals(expectedSize, size);
}
}
}
@Test
public void ensureSimpleGettersReturnNonNullAndDontFail() throws InvocationTargetException, IllegalAccessException {
TypeTester.ensureSimpleGettersReturnNonNullAndDontFail(TechType.class);
}
}