summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2017-05-08 10:05:26 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2017-05-08 10:05:26 +0200
commit6cb116e11443639a7e5e65b5f7784be67e440339 (patch)
tree037fbe3e33fe4e46868c5246d47580e59b6f18f0 /backend
parentRename "prepare card" to "prepare move" (diff)
downloadseven-wonders-6cb116e11443639a7e5e65b5f7784be67e440339.tar.gz
seven-wonders-6cb116e11443639a7e5e65b5f7784be67e440339.tar.bz2
seven-wonders-6cb116e11443639a7e5e65b5f7784be67e440339.zip
Extract test method createRequirements()
Diffstat (limited to 'backend')
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java9
-rw-r--r--backend/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java7
2 files changed, 9 insertions, 7 deletions
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java b/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java
index db8a016a..b46a5bb9 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/cards/RequirementsTest.java
@@ -9,7 +9,6 @@ import org.junit.runner.RunWith;
import org.luxons.sevenwonders.game.api.Table;
import org.luxons.sevenwonders.game.boards.Board;
import org.luxons.sevenwonders.game.resources.ResourceType;
-import org.luxons.sevenwonders.game.resources.Resources;
import org.luxons.sevenwonders.game.test.TestUtils;
import static org.junit.Assert.assertEquals;
@@ -44,9 +43,7 @@ public class RequirementsTest {
@Theory
public void resourceRequirement_initialResource(ResourceType initialResource, ResourceType requiredResource) {
- Resources resources = TestUtils.createResources(requiredResource);
- Requirements requirements = new Requirements();
- requirements.setResources(resources);
+ Requirements requirements = TestUtils.createRequirements(requiredResource);
Board board = TestUtils.createBoard(initialResource, 0);
Table table = new Table(Collections.singletonList(board));
@@ -64,9 +61,7 @@ public class RequirementsTest {
ResourceType requiredResource) {
assumeTrue(initialResource != requiredResource);
- Resources resources = TestUtils.createResources(requiredResource);
- Requirements requirements = new Requirements();
- requirements.setResources(resources);
+ Requirements requirements = TestUtils.createRequirements(requiredResource);
Board board = TestUtils.createBoard(initialResource, 0);
board.getProduction().addFixedResource(producedResource, 1);
diff --git a/backend/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java b/backend/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java
index a206cfb8..08cb10e8 100644
--- a/backend/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java
+++ b/backend/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java
@@ -108,6 +108,13 @@ public class TestUtils {
return boughtResources;
}
+ public static Requirements createRequirements(ResourceType... types) {
+ Resources resources = createResources(types);
+ Requirements requirements = new Requirements();
+ requirements.setResources(resources);
+ return requirements;
+ }
+
public static List<Card> createSampleCards(int fromIndex, int nbCards) {
List<Card> sampleCards = new ArrayList<>();
for (int i = fromIndex; i < fromIndex + nbCards; i++) {
bgstack15