diff options
author | Ida Massow <massow@informatik.uni-luebeck.de> | 2011-05-18 22:47:56 +0200 |
---|---|---|
committer | Ida Massow <massow@informatik.uni-luebeck.de> | 2011-05-18 22:47:56 +0200 |
commit | cb3f9cc011c29e713c14bee92c6bacbc3dbbf379 (patch) | |
tree | c0e62fcc4f5bac067bf080162d54c1fc9f276213 | |
parent | 39d3c143b202126faa14509aae132597c469f93d (diff) | |
download | JRummikub-cb3f9cc011c29e713c14bee92c6bacbc3dbbf379.tar JRummikub-cb3f9cc011c29e713c14bee92c6bacbc3dbbf379.zip |
Alle Test für Auslegen fertig
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@255 72836036-5685-4462-b002-a69064685172
-rw-r--r-- | test/jrummikub/control/RoundControlTest.java | 103 |
1 files changed, 84 insertions, 19 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java index 735c631..e320d35 100644 --- a/test/jrummikub/control/RoundControlTest.java +++ b/test/jrummikub/control/RoundControlTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; @@ -104,14 +103,16 @@ public class RoundControlTest { /** */ @Test public void laidOutValidTooFew() { + + RoundState roundState = new RoundState(null); + RoundControl roundControl = new RoundControl(roundState, view); + roundControl.startRound(); + IHand hand = roundState.getActivePlayer().getHand(); + Stone blueOne = new Stone(1, BLUE); Stone blueTwo = new Stone(2, BLUE); Stone blueThree = new Stone(3, BLUE); - RoundState roundState = new RoundState(); - RoundControl roundControl = new RoundControl(roundState, view); - - IHand hand = roundState.getActivePlayer().getHand(); hand.drop(blueOne, new Position(0, 0)); hand.drop(blueTwo, new Position(0, 0)); hand.drop(blueThree, new Position(0, 0)); @@ -126,11 +127,19 @@ public class RoundControlTest { new StoneSet(Arrays.asList(blueOne, blueTwo, blueThree)), new Position(0, 0)); + view.playerPanel.endTurnEvent.emit(); + assertTrue(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) + .getLaidOut()); } /** */ @Test public void laidOutInvalidEnough() { + RoundState roundState = new RoundState(null); + RoundControl roundControl = new RoundControl(roundState, view); + roundControl.startRound(); + IHand hand = roundState.getActivePlayer().getHand(); + Stone blueOne = new Stone(1, BLUE); Stone blueTwo = new Stone(2, BLUE); Stone blueThree = new Stone(3, BLUE); @@ -141,10 +150,6 @@ public class RoundControlTest { Stone orangeOne = new Stone(1, ORANGE); - RoundState roundState = new RoundState(); - RoundControl roundControl = new RoundControl(roundState, view); - - IHand hand = roundState.getActivePlayer().getHand(); hand.drop(blueOne, new Position(0, 0)); hand.drop(blueTwo, new Position(0, 0)); hand.drop(blueThree, new Position(0, 0)); @@ -154,15 +159,44 @@ public class RoundControlTest { hand.drop(redTen, new Position(0, 0)); hand.drop(orangeOne, new Position(0, 0)); + + hand.pickUp(orangeOne); + hand.pickUp(blueTwo); + hand.pickUp(blueThree); + + roundState.getTable().drop( + new StoneSet(Arrays.asList(orangeOne, blueTwo, blueThree)), + new Position(0, 0)); + + hand.pickUp(redEight); + hand.pickUp(redNine); + hand.pickUp(redTen); + + roundState.getTable().drop( + new StoneSet(Arrays.asList(redEight, redNine, redTen)), + new Position(0, 0)); + + view.playerPanel.endTurnEvent.emit(); + assertTrue(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) + .getLaidOut()); } /** */ @Test - public void laidOutEnoughChangedTable() { + public void laidOutTooFewChangedTable() { + RoundState roundState = new RoundState(null); + RoundControl roundControl = new RoundControl(roundState, view); + roundControl.startRound(); + IHand hand = roundState.getActivePlayer().getHand(); + Stone redEight = new Stone(8, RED); Stone redNine = new Stone(9, RED); Stone redTen = new Stone(10, RED); + hand.drop(redEight, new Position(0, 0)); + hand.drop(redNine, new Position(0, 0)); + hand.drop(redTen, new Position(0, 0)); + Stone blueSeven = new Stone(7, BLUE); Stone blackSeven = new Stone(7, BLACK); Stone redSeven = new Stone(7, RED); @@ -171,19 +205,39 @@ public class RoundControlTest { StoneSet sevenSet = new StoneSet(Arrays.asList(blueSeven, blackSeven, redSeven, orangeSeven)); - RoundState roundState = new RoundState(); - RoundControl roundControl = new RoundControl(roundState, view); + roundState.getTable().drop(sevenSet, new Position(0, 0)); + hand.pickUp(redEight); + hand.pickUp(redNine); + hand.pickUp(redTen); + roundState.getTable().pickUpStone(redSeven); + roundState.getTable() + .drop(new StoneSet(Arrays.asList(redSeven, redEight, redNine, + redTen)), new Position(0, 0)); + + view.playerPanel.endTurnEvent.emit(); + assertTrue(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) + .getLaidOut()); } /** */ @Test - public void laidOutTooFewChangedTable() { + public void laidOutEnoughChangedTable() { + RoundState roundState = new RoundState(null); + RoundControl roundControl = new RoundControl(roundState, view); + roundControl.startRound(); + IHand hand = roundState.getActivePlayer().getHand(); + Stone redEight = new Stone(8, RED); Stone redNine = new Stone(9, RED); Stone redTen = new Stone(10, RED); Stone redEleven = new Stone(11, RED); + hand.drop(redEight, new Position(0, 0)); + hand.drop(redNine, new Position(0, 0)); + hand.drop(redTen, new Position(0, 0)); + hand.drop(redEleven, new Position(0, 0)); + Stone blueSeven = new Stone(7, BLUE); Stone blackSeven = new Stone(7, BLACK); Stone redSeven = new Stone(7, RED); @@ -191,15 +245,30 @@ public class RoundControlTest { StoneSet sevenSet = new StoneSet(Arrays.asList(blueSeven, blackSeven, redSeven, orangeSeven)); + roundState.getTable().drop(sevenSet, new Position(0, 0)); - RoundState roundState = new RoundState(); - RoundControl roundControl = new RoundControl(roundState, view); + hand.pickUp(redEight); + hand.pickUp(redNine); + hand.pickUp(redTen); + hand.pickUp(redEleven); + roundState.getTable().pickUpStone(redSeven); + + roundState.getTable().drop( + new StoneSet(Arrays.asList(redSeven, redEight, redNine, redTen, + redEleven)), new Position(0, 0)); + view.playerPanel.endTurnEvent.emit(); + assertTrue(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) + .getLaidOut()); } /** */ @Test public void laidOutValid() { + RoundState roundState = new RoundState(null); + RoundControl roundControl = new RoundControl(roundState, view); + roundControl.startRound(); + IHand hand = roundState.getActivePlayer().getHand(); Stone blueOne = new Stone(1, BLUE); Stone blueTwo = new Stone(2, BLUE); @@ -209,10 +278,6 @@ public class RoundControlTest { Stone redNine = new Stone(9, RED); Stone redTen = new Stone(10, RED); - RoundState roundState = new RoundState(); - RoundControl roundControl = new RoundControl(roundState, view); - - IHand hand = roundState.getActivePlayer().getHand(); hand.drop(blueOne, new Position(0, 0)); hand.drop(blueTwo, new Position(0, 0)); hand.drop(blueThree, new Position(0, 0)); |