-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicAdventureTest.java
More file actions
37 lines (27 loc) · 1.09 KB
/
BasicAdventureTest.java
File metadata and controls
37 lines (27 loc) · 1.09 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
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import AdventureModel.AdventureGame;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class BasicAdventureTest {
@Test
void getCommandsTest() throws IOException {
AdventureGame game = new AdventureGame("TinyGame");
String actualCommands = game.player.getCurrentRoom().getCommands();
// Split the commands by comma and space, and sort them
List<String> actualList = Arrays.asList(actualCommands.split(", "));
Collections.sort(actualList);
List<String> expectedList = Arrays.asList("DOWN", "NORTH", "IN", "WEST", "UP", "SOUTH");
Collections.sort(expectedList);
// Compare the sorted lists
assertEquals(expectedList, actualList);
}
@Test
void getObjectString() throws IOException {
AdventureGame game = new AdventureGame("TinyGame");
String objects = game.player.getCurrentRoom().getObjectString();
assertEquals("a water bird", objects);
}
}