-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNetworkAdapterTest.java
47 lines (46 loc) · 1.81 KB
/
NetworkAdapterTest.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
import static org.junit.Assert.*;
import org.junit.Test;
public class NetworkAdapterTest {
@Test
public void testSendMoveNoTiger(){
NetworkAdapter networkAdapter = new NetworkAdapter();
String sendMove = networkAdapter.formatMove(0, "A", "A", 1, 0, 90, -1);
String expected = "GAME A MOVE 1 PLACE JJJJ- AT 1 0 90 NONE";
assertEquals(expected, sendMove);
}
@Test
public void testSendMoveCrocodile(){
NetworkAdapter networkAdapter = new NetworkAdapter();
String sendMove = networkAdapter.formatMove(1, "B", "E", 5, 5, 180, -1);
String expected = "GAME B MOVE 1 PLACE TJTJ- AT 5 5 180 CROCODILE";
assertEquals(expected, sendMove);
}
@Test
public void testSendMoveTiger(){
NetworkAdapter networkAdapter = new NetworkAdapter();
String sendMove = networkAdapter.formatMove(2, "A", "U", 3, 3, 270, 6);
String expected = "GAME A MOVE 1 PLACE TLLL- AT 3 3 270 TIGER 6";
assertEquals(expected, sendMove);
}
@Test
public void testSendPass(){
NetworkAdapter networkAdapter = new NetworkAdapter();
String sendMove = networkAdapter.formatMove(3, "A", "Z", 1, 1, 0, -1);
String expected = "GAME A MOVE 1 TILE LJTJ- UNPLACEABLE PASS";
assertEquals(expected, sendMove);
}
@Test
public void testUnplaceableRetrieveTiger(){
NetworkAdapter networkAdapter = new NetworkAdapter();
String sendMove = networkAdapter.formatMove(4, "A", "D", -2, 1, 0, -1);
String expected = "GAME A MOVE 1 TILE TTTT- UNPLACEABLE RETRIEVE TIGER AT -2 1";
assertEquals(expected, sendMove);
}
@Test
public void testUnplaceableAddTiger(){
NetworkAdapter networkAdapter = new NetworkAdapter();
String sendMove = networkAdapter.formatMove(5, "B", "S", 3, -4, 0, -1);
String expected = "GAME B MOVE 1 TILE TLTJ- UNPLACEABLE ADD ANOTHER TIGER TO 3 -4";
assertEquals(expected, sendMove);
}
}