diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2018-04-25 22:36:45 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2018-04-25 22:36:45 +0200 |
commit | c0036da04379022ce681356328c54f6bffb497f3 (patch) | |
tree | eece95fbb533ab144b53bf8d8f5ed6d4877d658d | |
parent | Add test for Table.getNeighbourGuildCards (diff) | |
download | seven-wonders-c0036da04379022ce681356328c54f6bffb497f3.tar.gz seven-wonders-c0036da04379022ce681356328c54f6bffb497f3.tar.bz2 seven-wonders-c0036da04379022ce681356328c54f6bffb497f3.zip |
Add WonderTest
-rw-r--r-- | game-engine/src/test/java/org/luxons/sevenwonders/game/wonders/WonderTest.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/game-engine/src/test/java/org/luxons/sevenwonders/game/wonders/WonderTest.java b/game-engine/src/test/java/org/luxons/sevenwonders/game/wonders/WonderTest.java new file mode 100644 index 00000000..5bf2affa --- /dev/null +++ b/game-engine/src/test/java/org/luxons/sevenwonders/game/wonders/WonderTest.java @@ -0,0 +1,37 @@ +package org.luxons.sevenwonders.game.wonders; + +import org.junit.Test; +import org.luxons.sevenwonders.game.cards.CardBack; +import org.luxons.sevenwonders.game.test.TestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class WonderTest { + + @Test + public void buildLevel_increasesNbBuiltStages() { + Wonder wonder = TestUtils.createWonder(); + assertEquals(0, wonder.getNbBuiltStages()); + wonder.buildLevel(new CardBack("img")); + assertEquals(1, wonder.getNbBuiltStages()); + wonder.buildLevel(new CardBack("img")); + assertEquals(2, wonder.getNbBuiltStages()); + wonder.buildLevel(new CardBack("img")); + assertEquals(3, wonder.getNbBuiltStages()); + } + + @Test + public void buildLevel_failsIfFull() { + Wonder wonder = TestUtils.createWonder(); + wonder.buildLevel(new CardBack("img")); + wonder.buildLevel(new CardBack("img")); + wonder.buildLevel(new CardBack("img")); + try { + wonder.buildLevel(new CardBack("img")); + fail(); + } catch (IllegalStateException e) { + // expected exception because there is no 4th level in this wonder + } + } +} |