-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTileTests.java
114 lines (78 loc) · 2.01 KB
/
TileTests.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package main;
import static org.junit.Assert.*;
import java.util.Random;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.sun.prism.paint.Color;
public class TileTests {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testPlayerCharge() {
for(int i = -10000; i < 10000; i++ ) {
Player player1 = new Player("One",0,null);
Player player2 = new Player("Two",1,null);
player1.charge(i, player2);
if(player1.getNetworth() != player1.DEFAULT_START_VALUE - i && player2.getNetworth() != player2.DEFAULT_START_VALUE + i) {
fail("Charge not working");
}
}
}
@Test
public void testMultipleHouses() {
Tile t = new Tile(100,0);
Player p1 = new Player(null,0,null);
Player p2 = new Player(null,0,null);
Bank b = new Bank(null, 0, null);
t.buy(p1, b);
if(p1.getNetworth() != 1900) {
fail("Player does not populate house");
}
t.visitedBy(p2);
if(p2.getNetworth() != 1990) {
fail("Player is not charged rent ");
}
t.visitedBy(p1);
t.visitedBy(p2);
if(p2.getNetworth() != 1970) {
fail("Player does not pay higher rent for multiple houses" + p2.getNetworth());
}
}
@Test
public void testPurchase() {
for(int i = -10; i < 1000; i++ ) {
Player p1 = new Player(null,0,null);
Tile t1 = new Tile(i,0);
Bank b = new Bank(null, 0, null);
t1.buy(p1, b);
if(t1.getOwnedBy().getId() != p1.getId()){
fail("Purchase from bank not working");
}
}
}
@Test
public void testFailToBuyLowMoney() {
for (int i = 2050; i < 2060; i++) {
Player player1 = new Player("One",0,null);
Bank bank = new Bank("Bank",0,null);
player1.charge(i,bank);
if (player1.getNetworth() == player1.DEFAULT_START_VALUE - i) {
fail("Blocked Purchase not Working");
}
}
}
@Test
public void testLimit40Tiles() {
//add test
}
@Test
public void testLimit4Houses() {
//add test
}
}