Job terrain #12
@ -1,6 +1,7 @@
|
||||
package Inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Inventory {
|
||||
@ -10,8 +11,8 @@ public class Inventory {
|
||||
items = new ArrayList<>();
|
||||
}
|
||||
|
||||
List<String> getItems() {
|
||||
return items;
|
||||
public List<String> getItems() {
|
||||
return Collections.unmodifiableList(items);
|
||||
}
|
||||
|
||||
public void addItem(String item) {
|
||||
|
||||
@ -7,6 +7,8 @@ import Entity.Player;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import Job.Wizard;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class PlayerTest {
|
||||
@ -55,7 +57,7 @@ class PlayerTest {
|
||||
var p = new Player("John");
|
||||
p.learnJob(new Miner());
|
||||
p.performAction(new DigAction());
|
||||
assertTrue(p.getInventory().containsItem("Stone"));
|
||||
assertThat(p.getInventory().getItems(), hasItem("Stone"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user