-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFoxTest.java
78 lines (75 loc) · 1.81 KB
/
FoxTest.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package edu.iastate.cs228.hw1;
import static org.junit.jupiter.api.Assertions.*;
import java.io.FileNotFoundException;
import org.junit.jupiter.api.Test;
/**
*
* @author Tim Kuehn
*
*/
class FoxTest
{
/**
* Tests the construction of a plain from the Fox constructor method
*/
@Test
void plainFoxConstructorTest()
{
Plain p = new Plain(5);
Fox a = new Fox(p, 1, 1, 2);
assertEquals(p, a.plain);
}
/**
* Tests the age of a Fox from the Fox construction method
*/
@Test
void ageFoxConstructorTest()
{
Plain p = new Plain(5);
Fox a = new Fox(p, 1, 1, 2);
assertEquals(2, a.age);
}
/**
* Tests the row of a Fox constructed using the Fox construction method
*/
@Test
void rowFoxConstructorTest()
{
Plain p = new Plain(5);
Fox a = new Fox(p, 1, 1, 2);
assertEquals(1, a.row);
}
/**
* Tests the column of a Fox constructed using the Fox construction method
*/
@Test
void columnFoxConstructorTest()
{
Plain p = new Plain(5);
Fox a = new Fox(p, 1, 1, 2);
assertEquals(1, a.column);
}
/**
* Tests the .who() method of a Fox constructed using the Fox construction
* method
*/
@Test
void whoFoxMethodTest()
{
Plain p = new Plain(5);
Fox a = new Fox(p, 4, 4, 2);
assertEquals(State.FOX, a.who());
}
/**
* Tests the next() method of a Fox constructed using the Fox construction
* method Requires nextAnimalTestCase.txt Requires funcional .toString() method
*/
@Test
void nextFoxMethod() throws FileNotFoundException
{
Plain p = new Plain("nextAnimalTestCase.txt");
p.grid[1][1] = p.grid[1][1].next(p);
assertEquals("F5 E E F0 E E \n" + "B3 E B0 R0 G R0 \n" + "R0 E R2 B0 B2 G \n"
+ "B0 E E R1 F0 E \n" + "B1 E E G E R0 \n" + "G G E B0 R2 E \n", p.toString());
}
}