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