forked from kiwi-coder/Rich-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSiteTest.java
More file actions
48 lines (39 loc) · 1.29 KB
/
SiteTest.java
File metadata and controls
48 lines (39 loc) · 1.29 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
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class SiteTest {
private static final int DUMMY_MONEY = 0;
private Map map;
@Before
public void setUp() {
map = TestHelper.simpleMap();
}
@Test
public void should_return_third_site_for_next_site_when_this_site_is_second_site() {
Site site = map.getSite(2);
assertThat(site.nextSite(), is(map.getSite(3)));
}
@Test
public void should_return_first_site_for_next_site_when_this_site_is_last_site() {
Site site = map.getSite(map.size() - 1);
assertThat(site.nextSite(), is(map.getSite(0)));
}
@Test
public void should_display_0_for_simple_map_site() {
assertThat(map.getSite(0).display(), is("0"));
}
@Test
public void should_display_player_if_there_is_player() {
Site site = map.getSite(0);
Player player = new Player("ATuBo", site, DUMMY_MONEY);
assertThat(site.display(), is("A"));
}
@Test
public void should_not_display_if_player_is_move_out() {
Site site = map.getSite(0);
Player player = new Player("ATuBo", site, DUMMY_MONEY);
player.forward(1);
assertThat(site.display(), is("0"));
}
}