forked from Progether/JAdventure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMonsterCreatorTests.java
56 lines (45 loc) · 1.39 KB
/
MonsterCreatorTests.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
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.ArrayList;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@RunWith(JUnit4.class)
public class MonsterCreatorTests {
MonsterCreator monsterCreator;
ArrayList<Monster> monsterArrayList;
@Before
public void setUp() {
monsterCreator = new MonsterCreator();
monsterArrayList = new ArrayList<Monster>();
monsterCreator.Generate(monsterArrayList);
}
@After
public void tearDown() {
monsterCreator = null;
}
@Test
public void testGenerate() {
assertEquals(monsterArrayList.isEmpty(), false);
assertEquals(monsterArrayList.size(), 1);
}
@Test
public void testGenerateName() {
assertThat(monsterArrayList.get(0).getName(), instanceOf(String.class));
}
@Test
public void testGenerateDamage() {
assertThat(monsterArrayList.get(0).getDamage(), instanceOf(double.class));
}
@Test
public void testGenerateHealth() {
assertThat(monsterArrayList.get(0).getHealthMax(), instanceOf(int.class));
}
@Test
public void testGenerateArmour() {
assertThat(monsterArrayList.get(0).getArmour(), instanceOf(int.class));
}
}