Kommentare und 2 Methoden, die jetzt kurz genug sind
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@446 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
2c9f1d5d20
commit
4f71c5cb47
10 changed files with 149 additions and 60 deletions
|
@ -6,9 +6,11 @@ import java.util.HashSet;
|
||||||
* Mock class for Event2s
|
* Mock class for Event2s
|
||||||
*
|
*
|
||||||
* @param <T1>
|
* @param <T1>
|
||||||
* first event type
|
* first event type
|
||||||
* @param <T2>
|
* @param <T2>
|
||||||
* second event type
|
* second event type
|
||||||
|
* @param <T3>
|
||||||
|
* third event type
|
||||||
*/
|
*/
|
||||||
public class MockEvent3<T1, T2, T3> implements IEvent3<T1, T2, T3> {
|
public class MockEvent3<T1, T2, T3> implements IEvent3<T1, T2, T3> {
|
||||||
/** */
|
/** */
|
||||||
|
@ -33,9 +35,11 @@ public class MockEvent3<T1, T2, T3> implements IEvent3<T1, T2, T3> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param value1
|
* @param value1
|
||||||
* the first event parameter
|
* the first event parameter
|
||||||
* @param value2
|
* @param value2
|
||||||
* the second event parameter
|
* the second event parameter
|
||||||
|
* @param value3
|
||||||
|
* the third event parameter
|
||||||
*/
|
*/
|
||||||
public void emit(T1 value1, T2 value2, T3 value3) {
|
public void emit(T1 value1, T2 value2, T3 value3) {
|
||||||
for (IListener3<T1, T2, T3> listener : listeners) {
|
for (IListener3<T1, T2, T3> listener : listeners) {
|
||||||
|
|
|
@ -10,8 +10,11 @@ import jrummikub.util.MockEvent1;
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public class MockGameListPanel implements IGameListPanel {
|
public class MockGameListPanel implements IGameListPanel {
|
||||||
|
/** */
|
||||||
public MockEvent1<GameData> joinEvent = new MockEvent1<GameData>();
|
public MockEvent1<GameData> joinEvent = new MockEvent1<GameData>();
|
||||||
|
/** */
|
||||||
public MockEvent openNewGameEvent = new MockEvent();
|
public MockEvent openNewGameEvent = new MockEvent();
|
||||||
|
/** */
|
||||||
public MockEvent cancelEvent = new MockEvent();
|
public MockEvent cancelEvent = new MockEvent();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,6 +17,10 @@ import jrummikub.util.IListener2;
|
||||||
import jrummikub.view.ISettingsPanel;
|
import jrummikub.view.ISettingsPanel;
|
||||||
import jrummikub.view.IView;
|
import jrummikub.view.IView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract control class managing joined methods and attributes of all
|
||||||
|
* different (network, default...) settings controls
|
||||||
|
*/
|
||||||
public abstract class AbstractSettingsControl {
|
public abstract class AbstractSettingsControl {
|
||||||
protected IView view;
|
protected IView view;
|
||||||
protected List<Connection> connections = new ArrayList<Connection>();
|
protected List<Connection> connections = new ArrayList<Connection>();
|
||||||
|
@ -45,15 +49,15 @@ public abstract class AbstractSettingsControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPlayerSettingsListeners() {
|
private void addPlayerSettingsListeners() {
|
||||||
connections.add(view.getSettingsPanel().getAddPlayerEvent()
|
connections.add(view.getSettingsPanel().getAddPlayerEvent().add(
|
||||||
.add(new IListener() {
|
new IListener() {
|
||||||
@Override
|
@Override
|
||||||
public void handle() {
|
public void handle() {
|
||||||
addPlayer();
|
addPlayer();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
connections.add(view.getSettingsPanel().getRemovePlayerEvent()
|
connections.add(view.getSettingsPanel().getRemovePlayerEvent().add(
|
||||||
.add(new IListener1<Integer>() {
|
new IListener1<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer i) {
|
public void handle(Integer i) {
|
||||||
removePlayer(i);
|
removePlayer(i);
|
||||||
|
@ -66,32 +70,32 @@ public abstract class AbstractSettingsControl {
|
||||||
setPlayerColor(i, color);
|
setPlayerColor(i, color);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
connections.add(view.getSettingsPanel().getChangePlayerNameEvent()
|
connections.add(view.getSettingsPanel().getChangePlayerNameEvent().add(
|
||||||
.add(new IListener2<Integer, String>() {
|
new IListener2<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer i, String name) {
|
public void handle(Integer i, String name) {
|
||||||
setPlayerName(i, name);
|
setPlayerName(i, name);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
connections.add(view.getSettingsPanel().getChangePlayerTypeEvent()
|
connections.add(view.getSettingsPanel().getChangePlayerTypeEvent().add(
|
||||||
.add(new IListener2<Integer, Type>() {
|
new IListener2<Integer, Type>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer i, Type type) {
|
public void handle(Integer i, Type type) {
|
||||||
setPlayerType(i, type);
|
setPlayerType(i, type);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOptionListeners1() {
|
private void addOptionListeners1() {
|
||||||
connections.add(view.getSettingsPanel()
|
connections.add(view.getSettingsPanel()
|
||||||
.getChangeInitialMeldThresholdEvent()
|
.getChangeInitialMeldThresholdEvent().add(
|
||||||
.add(new IListener1<Integer>() {
|
new IListener1<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer value) {
|
public void handle(Integer value) {
|
||||||
settings.setInitialMeldThreshold(value);
|
settings.setInitialMeldThreshold(value);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
connections.add(view.getSettingsPanel().getChangeJokerNumberEvent()
|
connections.add(view.getSettingsPanel().getChangeJokerNumberEvent()
|
||||||
.add(new IListener1<Integer>() {
|
.add(new IListener1<Integer>() {
|
||||||
|
@ -111,14 +115,14 @@ public abstract class AbstractSettingsControl {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
connections.add(view.getSettingsPanel()
|
connections.add(view.getSettingsPanel()
|
||||||
.getChangeNumberOfStonesDealtEvent()
|
.getChangeNumberOfStonesDealtEvent().add(
|
||||||
.add(new IListener1<Integer>() {
|
new IListener1<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer value) {
|
public void handle(Integer value) {
|
||||||
settings.setNumberOfStonesDealt(value);
|
settings.setNumberOfStonesDealt(value);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOptionListeners2() {
|
private void addOptionListeners2() {
|
||||||
|
@ -130,8 +134,8 @@ public abstract class AbstractSettingsControl {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
connections.add(view.getSettingsPanel().getChangeTimeEvent()
|
connections.add(view.getSettingsPanel().getChangeTimeEvent().add(
|
||||||
.add(new IListener1<Integer>() {
|
new IListener1<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer value) {
|
public void handle(Integer value) {
|
||||||
settings.setTotalTime(value);
|
settings.setTotalTime(value);
|
||||||
|
@ -147,8 +151,8 @@ public abstract class AbstractSettingsControl {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
connections.add(view.getSettingsPanel().getChangeNoLimitsEvent()
|
connections.add(view.getSettingsPanel().getChangeNoLimitsEvent().add(
|
||||||
.add(new IListener1<Boolean>() {
|
new IListener1<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Boolean value) {
|
public void handle(Boolean value) {
|
||||||
settings.setNoLimits(value);
|
settings.setNoLimits(value);
|
||||||
|
@ -182,7 +186,7 @@ public abstract class AbstractSettingsControl {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the operation of the settings control
|
* Start the operation of the settings control
|
||||||
*/
|
*/
|
||||||
|
@ -231,7 +235,7 @@ public abstract class AbstractSettingsControl {
|
||||||
settings.getPlayerList().remove(i);
|
settings.getPlayerList().remove(i);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkSettings() {
|
protected boolean checkSettings() {
|
||||||
if (!checkName()) {
|
if (!checkName()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -269,7 +273,8 @@ public abstract class AbstractSettingsControl {
|
||||||
for (int j = i + 1; j < settings.getPlayerList().size(); ++j) {
|
for (int j = i + 1; j < settings.getPlayerList().size(); ++j) {
|
||||||
PlayerSettings player2 = settings.getPlayerList().get(j);
|
PlayerSettings player2 = settings.getPlayerList().get(j);
|
||||||
if (player2.getName().equals(name) && player2.getType() == type) {
|
if (player2.getName().equals(name) && player2.getType() == type) {
|
||||||
view.getSettingsPanel()
|
view
|
||||||
|
.getSettingsPanel()
|
||||||
.setError(
|
.setError(
|
||||||
ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
|
ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
|
||||||
view.getSettingsPanel().enableStartGameButton(false);
|
view.getSettingsPanel().enableStartGameButton(false);
|
||||||
|
@ -325,7 +330,7 @@ public abstract class AbstractSettingsControl {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abort settings control once settings are set
|
* Abort settings control once settings are set
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class Pair<T1, T2> implements Serializable {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
|
@ -69,7 +70,6 @@ public class Pair<T1, T2> implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
Pair other = (Pair) obj;
|
Pair other = (Pair) obj;
|
||||||
if (first == null) {
|
if (first == null) {
|
||||||
if (other.first != null)
|
if (other.first != null)
|
||||||
|
|
|
@ -35,9 +35,15 @@ public interface IGameListPanel {
|
||||||
* Sets the channel name
|
* Sets the channel name
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* channel name
|
* channel name
|
||||||
*/
|
*/
|
||||||
public void setChannelName(String name);
|
public void setChannelName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the games (host and player count) into the game list
|
||||||
|
*
|
||||||
|
* @param games
|
||||||
|
* list of game data
|
||||||
|
*/
|
||||||
public void setGameList(List<GameData> games);
|
public void setGameList(List<GameData> games);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,10 @@ public interface ISettingsPanel {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enables the start of a network game at a given point in game
|
* Sets the settings mode according to the point of the game
|
||||||
*
|
*
|
||||||
* @param enable
|
* @param mode
|
||||||
* starting a network game
|
* settings mode to be set (join, offer, network, default)
|
||||||
*/
|
*/
|
||||||
public void setSettingsMode(SettingsMode mode);
|
public void setSettingsMode(SettingsMode mode);
|
||||||
|
|
||||||
|
@ -237,6 +237,12 @@ public interface ISettingsPanel {
|
||||||
*/
|
*/
|
||||||
public IEvent getOfferGameEvent();
|
public IEvent getOfferGameEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the player colors which can be chosen
|
||||||
|
*
|
||||||
|
* @param colors
|
||||||
|
* a Set of colors which are not taken yet
|
||||||
|
*/
|
||||||
public void setPlayerColors(Set<Color> colors);
|
public void setPlayerColors(Set<Color> colors);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -260,13 +266,14 @@ public interface ISettingsPanel {
|
||||||
/** Only computer players added */
|
/** Only computer players added */
|
||||||
COMPUTER_PLAYERS_ONLY_WARNING
|
COMPUTER_PLAYERS_ONLY_WARNING
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SettingsPanel can be used with different functions in different situations
|
* SettingsPanel can be used with different functions in different
|
||||||
|
* situations
|
||||||
*/
|
*/
|
||||||
public enum SettingsMode {
|
public enum SettingsMode {
|
||||||
/**Local game settings */
|
/** Local game settings */
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
/** */
|
/** */
|
||||||
NETWORK_SETUP,
|
NETWORK_SETUP,
|
||||||
/** */
|
/** */
|
||||||
|
|
|
@ -162,22 +162,70 @@ public interface IView {
|
||||||
*/
|
*/
|
||||||
public IEvent1<File> getSaveEvent();
|
public IEvent1<File> getSaveEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pause event is emitted when the user wants to pause the current turn
|
||||||
|
*
|
||||||
|
* @return the event
|
||||||
|
*/
|
||||||
public IEvent getPauseEvent();
|
public IEvent getPauseEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end pause event is emitted when the user wants to sresume the game
|
||||||
|
* after a pause
|
||||||
|
*
|
||||||
|
* @return the event
|
||||||
|
*/
|
||||||
public IEvent getEndPauseEvent();
|
public IEvent getEndPauseEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides all view elements and panels except for the cleared table and an
|
||||||
|
* empty hand panel
|
||||||
|
*/
|
||||||
public void clearView();
|
public void clearView();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The network game event is emitted when the user chooses a network game
|
||||||
|
*
|
||||||
|
* @return the event
|
||||||
|
*/
|
||||||
public IEvent getNetworkGameEvent();
|
public IEvent getNetworkGameEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for login panel
|
||||||
|
*
|
||||||
|
* @return login panel
|
||||||
|
*/
|
||||||
public ILoginPanel getLoginPanel();
|
public ILoginPanel getLoginPanel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for game list panel
|
||||||
|
*
|
||||||
|
* @return game list panel
|
||||||
|
*/
|
||||||
public IGameListPanel getGameListPanel();
|
public IGameListPanel getGameListPanel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show/hide login panel
|
||||||
|
*
|
||||||
|
* @param show
|
||||||
|
* true = login panel is shown
|
||||||
|
*/
|
||||||
public void showLoginPanel(boolean show);
|
public void showLoginPanel(boolean show);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable pause mode
|
||||||
|
*
|
||||||
|
* @param enable
|
||||||
|
* true = enable
|
||||||
|
*/
|
||||||
public void enablePauseMode(boolean enable);
|
public void enablePauseMode(boolean enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show/hide game list panel
|
||||||
|
*
|
||||||
|
* @param show
|
||||||
|
* true = show
|
||||||
|
*/
|
||||||
public void showGameListPanel(boolean show);
|
public void showGameListPanel(boolean show);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,8 @@ import jrummikub.util.IEvent1;
|
||||||
import jrummikub.view.IGameListPanel;
|
import jrummikub.view.IGameListPanel;
|
||||||
|
|
||||||
class GameListPanel extends JPanel implements IGameListPanel {
|
class GameListPanel extends JPanel implements IGameListPanel {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel title;
|
private JLabel title;
|
||||||
private JList gameList;
|
private JList gameList;
|
||||||
private JButton joinButton;
|
private JButton joinButton;
|
||||||
|
@ -67,6 +69,13 @@ class GameListPanel extends JPanel implements IGameListPanel {
|
||||||
c.weighty = 0;
|
c.weighty = 0;
|
||||||
add(Box.createVerticalStrut(3), c);
|
add(Box.createVerticalStrut(3), c);
|
||||||
|
|
||||||
|
addButtons(c);
|
||||||
|
|
||||||
|
setBorder(new CompoundBorder(new LineBorder(Color.BLACK),
|
||||||
|
new EmptyBorder(10, 10, 10, 10)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addButtons(GridBagConstraints c) {
|
||||||
joinButton = new JButton("Beitreten");
|
joinButton = new JButton("Beitreten");
|
||||||
c.gridwidth = 1;
|
c.gridwidth = 1;
|
||||||
add(joinButton, c);
|
add(joinButton, c);
|
||||||
|
@ -109,9 +118,6 @@ class GameListPanel extends JPanel implements IGameListPanel {
|
||||||
cancelEvent.emit();
|
cancelEvent.emit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setBorder(new CompoundBorder(new LineBorder(Color.BLACK), new EmptyBorder(
|
|
||||||
10, 10, 10, 10)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
@ -157,6 +163,7 @@ class GameListPanel extends JPanel implements IGameListPanel {
|
||||||
|
|
||||||
private static class GameDataCellRenderer extends JPanel implements
|
private static class GameDataCellRenderer extends JPanel implements
|
||||||
ListCellRenderer {
|
ListCellRenderer {
|
||||||
|
private static final long serialVersionUID = -892701906163443927L;
|
||||||
JLabel hostLabel, playerCountLabel;
|
JLabel hostLabel, playerCountLabel;
|
||||||
|
|
||||||
GameDataCellRenderer() {
|
GameDataCellRenderer() {
|
||||||
|
@ -193,7 +200,8 @@ class GameListPanel extends JPanel implements IGameListPanel {
|
||||||
int total = gameData.getGameSettings().getPlayerList().size();
|
int total = gameData.getGameSettings().getPlayerList().size();
|
||||||
int occupied = total;
|
int occupied = total;
|
||||||
|
|
||||||
for (PlayerSettings player : gameData.getGameSettings().getPlayerList()) {
|
for (PlayerSettings player : gameData.getGameSettings()
|
||||||
|
.getPlayerList()) {
|
||||||
if (player.getType() == Type.VACANT) {
|
if (player.getType() == Type.VACANT) {
|
||||||
occupied--;
|
occupied--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,12 @@ import jrummikub.view.MockView;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/** */
|
||||||
public class SaveControlTest {
|
public class SaveControlTest {
|
||||||
|
/**
|
||||||
|
* @throws IOException
|
||||||
|
* if input cannot be saved/loaded
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSaveLoad() throws IOException {
|
public void testSaveLoad() throws IOException {
|
||||||
GameSettings settings = new GameSettings();
|
GameSettings settings = new GameSettings();
|
||||||
|
|
|
@ -54,8 +54,7 @@ public class StoneSetTest {
|
||||||
// valid+point count
|
// valid+point count
|
||||||
/** */
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void doubleJokerValid() {
|
public void doubleJokerValid3Stones() {
|
||||||
// 3 Stones
|
|
||||||
// JJZ
|
// JJZ
|
||||||
assertSet(GROUP, 3, Arrays.asList(new Stone(RED), new Stone(BLACK),
|
assertSet(GROUP, 3, Arrays.asList(new Stone(RED), new Stone(BLACK),
|
||||||
new Stone(1, BLACK)), defaultSettings);
|
new Stone(1, BLACK)), defaultSettings);
|
||||||
|
@ -73,6 +72,11 @@ public class StoneSetTest {
|
||||||
new Stone(BLACK)), defaultSettings);
|
new Stone(BLACK)), defaultSettings);
|
||||||
assertSet(RUN, 42, Arrays.asList(new Stone(13, RED), new Stone(RED),
|
assertSet(RUN, 42, Arrays.asList(new Stone(13, RED), new Stone(RED),
|
||||||
new Stone(BLACK)), higherValueSettings);
|
new Stone(BLACK)), higherValueSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
@Test
|
||||||
|
public void doubleJokerValid4Stones() {
|
||||||
// 4 Stones
|
// 4 Stones
|
||||||
// JJZZ
|
// JJZZ
|
||||||
assertSet(GROUP, 4, Arrays.asList(new Stone(RED), new Stone(BLACK),
|
assertSet(GROUP, 4, Arrays.asList(new Stone(RED), new Stone(BLACK),
|
||||||
|
@ -164,6 +168,7 @@ public class StoneSetTest {
|
||||||
new Stone(13, RED), new Stone(RED)), higherValueSettings);
|
new Stone(13, RED), new Stone(RED)), higherValueSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void noLimitsTest() {
|
public void noLimitsTest() {
|
||||||
assertSet(RUN, 16, Arrays.asList(new Stone(RED), new Stone(1, RED),
|
assertSet(RUN, 16, Arrays.asList(new Stone(RED), new Stone(1, RED),
|
||||||
|
@ -245,9 +250,8 @@ public class StoneSetTest {
|
||||||
new Stone(5, RED), new Stone(7, RED)), defaultSettings);
|
new Stone(5, RED), new Stone(7, RED)), defaultSettings);
|
||||||
assertSet(INVALID, 0, Arrays.asList(new Stone(4, RED), new Stone(5,
|
assertSet(INVALID, 0, Arrays.asList(new Stone(4, RED), new Stone(5,
|
||||||
BLUE), new Stone(6, RED)), defaultSettings);
|
BLUE), new Stone(6, RED)), defaultSettings);
|
||||||
assertSet(INVALID, 0,
|
assertSet(INVALID, 0, Arrays.asList(new Stone(4, RED),
|
||||||
Arrays.asList(new Stone(4, RED), new Stone(5, RED)),
|
new Stone(5, RED)), defaultSettings);
|
||||||
defaultSettings);
|
|
||||||
assertSet(INVALID, 0, Arrays.asList(new Stone(4, BLUE), new Stone(5,
|
assertSet(INVALID, 0, Arrays.asList(new Stone(4, BLUE), new Stone(5,
|
||||||
RED), new Stone(6, RED)), defaultSettings);
|
RED), new Stone(6, RED)), defaultSettings);
|
||||||
// Regression test:
|
// Regression test:
|
||||||
|
@ -258,9 +262,8 @@ public class StoneSetTest {
|
||||||
/** */
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void manyJokersValid() {
|
public void manyJokersValid() {
|
||||||
assertSet(GROUP, 3 * 13,
|
assertSet(GROUP, 3 * 13, Arrays.asList(new Stone(RED), new Stone(RED),
|
||||||
Arrays.asList(new Stone(RED), new Stone(RED), new Stone(RED)),
|
new Stone(RED)), defaultSettings);
|
||||||
defaultSettings);
|
|
||||||
assertSet(GROUP, 4 * 13, Arrays.asList(new Stone(RED), new Stone(RED),
|
assertSet(GROUP, 4 * 13, Arrays.asList(new Stone(RED), new Stone(RED),
|
||||||
new Stone(RED), new Stone(RED)), defaultSettings);
|
new Stone(RED), new Stone(RED)), defaultSettings);
|
||||||
assertSet(RUN, 13 + 12 + 11 + 10 + 9,
|
assertSet(RUN, 13 + 12 + 11 + 10 + 9,
|
||||||
|
@ -269,8 +272,8 @@ public class StoneSetTest {
|
||||||
assertSet(RUN, 5 * 10, Arrays.asList(new Stone(RED), new Stone(RED),
|
assertSet(RUN, 5 * 10, Arrays.asList(new Stone(RED), new Stone(RED),
|
||||||
new Stone(RED), new Stone(RED), new Stone(12, RED)),
|
new Stone(RED), new Stone(RED), new Stone(12, RED)),
|
||||||
defaultSettings);
|
defaultSettings);
|
||||||
assertSet(GROUP, 6 * 5,
|
assertSet(GROUP, 6 * 5, Arrays
|
||||||
Arrays.asList(new Stone(RED), new Stone(RED), new Stone(RED),
|
.asList(new Stone(RED), new Stone(RED), new Stone(RED),
|
||||||
new Stone(RED), new Stone(RED), new Stone(AQUA)),
|
new Stone(RED), new Stone(RED), new Stone(AQUA)),
|
||||||
moreColorLowerValueSettings);
|
moreColorLowerValueSettings);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue