diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/jrummikub/control/SettingsControlTest.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/test/jrummikub/control/SettingsControlTest.java b/test/jrummikub/control/SettingsControlTest.java index f0e4ae0..8dc286c 100644 --- a/test/jrummikub/control/SettingsControlTest.java +++ b/test/jrummikub/control/SettingsControlTest.java @@ -12,11 +12,13 @@ import jrummikub.view.MockView; import org.junit.Before; import org.junit.Test; +/** */ public class SettingsControlTest { MockView view = new MockView(); SettingsControl settingsControl = new SettingsControl(view); GameSettings gameSettings = null; + /** */ @Before public void setup() { settingsControl.getStartGameEvent().add(new IListener1<GameSettings>() { @@ -24,21 +26,23 @@ public class SettingsControlTest { @Override public void handle(GameSettings value) { gameSettings = value; - } }); + + settingsControl.startSettings(); } + /** */ @Test public void initialStateTest() { - assertSame(ISettingsPanel.SettingsError.NO_ERROR, - view.settingsPanel.error); + assertSame(ISettingsPanel.SettingsError.NO_ERROR, view.settingsPanel.error); view.settingsPanel.startGameEvent.emit(); assertNotNull(gameSettings); assertEquals(2, gameSettings.getPlayerList().size()); assertFalse(view.settingsPanel.removePlayerButtonsEnabled); } + /** */ @Test public void addPlayerTest() { view.settingsPanel.addPlayerEvent.emit(); @@ -48,6 +52,7 @@ public class SettingsControlTest { assertTrue(view.settingsPanel.removePlayerButtonsEnabled); } + /** */ @Test public void add14PlayerTest() { for (int i = 0; i < 14; i++) { @@ -60,6 +65,7 @@ public class SettingsControlTest { assertFalse(view.settingsPanel.addPlayerButtonEnabled); } + /** */ @Test public void add14RemovePlayerTest() { for (int i = 0; i < 14; i++) { @@ -73,6 +79,7 @@ public class SettingsControlTest { assertTrue(view.settingsPanel.addPlayerButtonEnabled); } + /** */ @Test public void removePlayerTest() { view.settingsPanel.addPlayerEvent.emit(); @@ -83,6 +90,7 @@ public class SettingsControlTest { assertFalse(view.settingsPanel.removePlayerButtonsEnabled); } + /** */ @Test public void takenColorTest() { Color color1 = Color.RED; @@ -97,6 +105,7 @@ public class SettingsControlTest { assertSame(color1, gameSettings.getPlayerList().get(1).getColor()); } + /** */ @Test public void unusedColorTest() { Color color1 = Color.RED; @@ -112,6 +121,7 @@ public class SettingsControlTest { assertSame(color3, gameSettings.getPlayerList().get(1).getColor()); } + /** */ @Test public void takenNameTest() { String name1 = "Julia"; @@ -126,6 +136,7 @@ public class SettingsControlTest { assertNull(gameSettings); } + /** */ @Test public void fixTakenNameTest() { String name1 = "Julia"; @@ -143,13 +154,13 @@ public class SettingsControlTest { view.settingsPanel.changePlayerNameEvent.emit(1, name2); assertTrue(view.settingsPanel.startButtonEnabled); - assertSame(ISettingsPanel.SettingsError.NO_ERROR, - view.settingsPanel.error); + assertSame(ISettingsPanel.SettingsError.NO_ERROR, view.settingsPanel.error); view.settingsPanel.startGameEvent.emit(); assertNotNull(gameSettings); } + /** */ @Test public void emptyNameTest() { String name1 = ""; |