diff options
Diffstat (limited to 'test/jrummikub/control')
-rw-r--r-- | test/jrummikub/control/RoundControlTest.java | 17 | ||||
-rw-r--r-- | test/jrummikub/control/TurnControlTest.java | 37 |
2 files changed, 51 insertions, 3 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java index f183505..6c8dffe 100644 --- a/test/jrummikub/control/RoundControlTest.java +++ b/test/jrummikub/control/RoundControlTest.java @@ -26,12 +26,18 @@ import jrummikub.view.MockView; import org.junit.Before; import org.junit.Test; +/** + * Tests for {@link RoundControl} + */ public class RoundControlTest { private MockView view; private MockGameState testGameState; private RoundControl testRound; private MockTable newTable; + /** + * For each test create a round control initialized by a mock model and view + */ @Before public void setup() { view = new MockView(); @@ -86,7 +92,7 @@ public class RoundControlTest { view.displayStartTurnPanel = false; } - // TODO hier weitermachen + /** */ @Test public void testDealStone() { testRound.deal(); @@ -97,12 +103,14 @@ public class RoundControlTest { assertEquals(28, testGameState.getActivePlayer().getHand().getSize()); } + /** */ @Test public void testDeal() { testRound.deal(); checkCorrectlyDealed(); } + /** */ @Test public void testStartRound() { testRound.startRound(); @@ -111,6 +119,7 @@ public class RoundControlTest { checkTurnStartSetUp(); } + /** */ @Test public void testTableDisplay() { testRound.startRound(); @@ -120,6 +129,7 @@ public class RoundControlTest { view.getPlayerPanel().endTurnEvent.emit(); } + /** */ @Test public void testTableValidHandChanged() { testRound.startRound(); @@ -139,6 +149,7 @@ public class RoundControlTest { checkTurnStartSetUp(); } + /** */ @Test public void testTableInvalidHandChanged() { testRound.startRound(); @@ -160,6 +171,7 @@ public class RoundControlTest { checkTurnStartSetUp(); } + /** */ @Test public void testTableValidHandUnchanged() { testRound.startRound(); @@ -179,6 +191,7 @@ public class RoundControlTest { checkTurnStartSetUp(); } + /** */ @Test public void testTableInvalidHandUnchanged() { testRound.startRound(); @@ -198,6 +211,7 @@ public class RoundControlTest { checkTurnStartSetUp(); } + /** */ @Test public void testWinning() { testRound.startRound(); @@ -217,6 +231,7 @@ public class RoundControlTest { assertTrue(view.displayWinPanel); } + /** */ @Test public void testTableDifference() { MockTable oldTable = new MockTable(); diff --git a/test/jrummikub/control/TurnControlTest.java b/test/jrummikub/control/TurnControlTest.java index 4d6d0c2..197623e 100644 --- a/test/jrummikub/control/TurnControlTest.java +++ b/test/jrummikub/control/TurnControlTest.java @@ -34,6 +34,9 @@ import jrummikub.view.MockView; import org.junit.Before; import org.junit.Test; +/** + * Tests for {@link TurnControl} + */ public class TurnControlTest { static class AccessibleTable extends Table { StoneSet[] getSetArray() { @@ -93,6 +96,7 @@ public class TurnControlTest { assertFalse(stoneSetsModel.hasNext()); } + /** */ @Before public void setUp() { mockView = new MockView(); @@ -102,6 +106,7 @@ public class TurnControlTest { testControl = new TurnControl(mockHand, mockTable, mockView, mockTimer); } + /** */ @Test public void startTimer() { testControl.startTurn(); @@ -109,6 +114,7 @@ public class TurnControlTest { assertTrue(mockTimer.timerRunning); } + /** */ @SuppressWarnings("unchecked") @Test public void showInitialHand() { @@ -134,6 +140,7 @@ public class TurnControlTest { assertFalse(mockView.displayStartTurnPanel); } + /** */ @Test public void viewEndOfTurn() { testControl.startTurn(); @@ -156,6 +163,7 @@ public class TurnControlTest { assertTrue(mockView.playerPanel.endTurnEvent.listeners.isEmpty()); } + /** */ @Test public void timerEndOfTurn() { testControl.startTurn(); @@ -177,6 +185,7 @@ public class TurnControlTest { assertFalse(mockTimer.timerRunning); } + /** */ @Test public void deselctOnEndOfTurn() { testControl.startTurn(); @@ -190,6 +199,7 @@ public class TurnControlTest { assertCollection(new ArrayList<Stone>()); } + /** */ @Test public void selectStoneInHand() { testControl.startTurn(); @@ -209,6 +219,7 @@ public class TurnControlTest { } + /** */ @Test public void collectStoneInHand() { testControl.startTurn(); @@ -232,6 +243,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(secondStone)); } + /** */ @Test public void deselectStoneInCollection() { testControl.startTurn(); @@ -248,6 +260,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(secondStone)); } + /** */ @Test public void reorderCollection() { testControl.startTurn(); @@ -264,6 +277,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(secondStone, firstStone)); } + /** */ @Test public void deselectWholeCollection() { testControl.startTurn(); @@ -283,6 +297,7 @@ public class TurnControlTest { assertCollection(new ArrayList<Stone>()); } + /** */ @Test public void selectStoneOnTable() { testControl.startTurn(); @@ -302,6 +317,7 @@ public class TurnControlTest { } + /** */ @Test public void collectStoneOnTable() { testControl.startTurn(); @@ -325,6 +341,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(secondStone)); } + /** */ @Test public void selectSetOnTable() { testControl.startTurn(); @@ -347,6 +364,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(stone3, stone4)); } + /** */ @Test public void collectSetOnTable() { testControl.startTurn(); @@ -369,6 +387,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(stone1, stone2, stone3, stone4)); } + /** */ @Test public void rangeSelectOnTableReverse() { testControl.startTurn(); @@ -389,6 +408,7 @@ public class TurnControlTest { } + /** */ @Test public void rangeSelectOnTable() { testControl.startTurn(); @@ -409,6 +429,7 @@ public class TurnControlTest { } + /** */ @Test public void rangeCollectOnTable() { testControl.startTurn(); @@ -432,6 +453,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(extraStone, stone1, stone2, stone3)); } + /** */ @Test public void rangeFailSelect() { testControl.startTurn(); @@ -456,6 +478,7 @@ public class TurnControlTest { } + /** */ @Test public void rangeFailCollect() { testControl.startTurn(); @@ -479,6 +502,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(stone1, stone2)); } + /** */ @Test public void rangeSelectOnHandReverse() { testControl.startTurn(); @@ -498,6 +522,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(stone1, stone2, stone3)); } + /** */ @Test public void rangeSelectOnHand() { testControl.startTurn(); @@ -517,6 +542,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(stone1, stone2, stone3)); } + /** */ @Test public void rangeCollectOnHand() { testControl.startTurn(); @@ -539,6 +565,7 @@ public class TurnControlTest { assertCollection(Arrays.asList(extraStone, stone1, stone2, stone3)); } + /** */ @Test public void rangeFailSelectHand() { testControl.startTurn(); @@ -560,6 +587,7 @@ public class TurnControlTest { } + /** */ @Test public void rangeFailCollectHand() { testControl.startTurn(); @@ -587,6 +615,7 @@ public class TurnControlTest { assertEquals(expectedStones, selectedStones); } + /** */ @Test public void testAddLeft() { AccessibleTable table = new AccessibleTable(); @@ -703,6 +732,7 @@ public class TurnControlTest { assertSame(newSet2.get(5), blackFive); } + /** */ @Test public void testAddRight() { AccessibleTable table = new AccessibleTable(); @@ -819,6 +849,7 @@ public class TurnControlTest { assertSame(newSet2.get(5), redThree); } + /** */ @Test public void testAddNewSet() { AccessibleTable table = new AccessibleTable(); @@ -908,7 +939,7 @@ public class TurnControlTest { checkTableDisplay(table); checkHandDisplay(mockHand); } - + /** */ @Test public void testSortByGroups() { testControl.startTurn(); @@ -969,6 +1000,7 @@ public class TurnControlTest { checkHandDisplay(mockHand); } + /** */ @Test public void testSortByRuns() { testControl.startTurn(); @@ -1029,6 +1061,7 @@ public class TurnControlTest { checkHandDisplay(mockHand); } + /** */ @Test public void testDropHandValid() { testControl.startTurn(); @@ -1056,7 +1089,7 @@ public class TurnControlTest { } assertEquals(expected, handStones); } - + /** */ @Test public void testDropHandInvalid() { testControl.startTurn(); |