Created interface and abstract base class for turn control
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@307 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
f62b953c9e
commit
73f6fb9c1b
5 changed files with 76 additions and 40 deletions
|
@ -1,4 +1,4 @@
|
|||
package jrummikub.control;
|
||||
package jrummikub.control.turn;
|
||||
|
||||
import static jrummikub.model.StoneColor.BLACK;
|
||||
import static jrummikub.model.StoneColor.BLUE;
|
||||
|
@ -16,6 +16,8 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import jrummikub.control.ITurnTimer;
|
||||
import jrummikub.control.turn.HumanTurnControl;
|
||||
import jrummikub.model.IHand;
|
||||
import jrummikub.model.ITable;
|
||||
import jrummikub.model.MockHand;
|
||||
|
@ -35,7 +37,7 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests for {@link TurnControl}
|
||||
* Tests for {@link HumanTurnControl}
|
||||
*/
|
||||
public class TurnControlTest {
|
||||
static class AccessibleTable extends Table {
|
||||
|
@ -65,7 +67,7 @@ public class TurnControlTest {
|
|||
|
||||
}
|
||||
|
||||
TurnControl testControl;
|
||||
HumanTurnControl testControl;
|
||||
MockView mockView;
|
||||
MockTimer mockTimer;
|
||||
MockTable mockTable;
|
||||
|
@ -103,7 +105,7 @@ public class TurnControlTest {
|
|||
mockTimer = new MockTimer();
|
||||
mockTable = new MockTable();
|
||||
mockHand = new MockHand();
|
||||
testControl = new TurnControl(mockHand, mockTable, mockView, mockTimer);
|
||||
testControl = new HumanTurnControl(mockHand, mockTable, mockView, mockTimer);
|
||||
}
|
||||
|
||||
/** */
|
||||
|
@ -126,7 +128,7 @@ public class TurnControlTest {
|
|||
|
||||
mockHand.iterable = stones;
|
||||
|
||||
testControl = new TurnControl(mockHand, mockTable, mockView, mockTimer);
|
||||
testControl = new HumanTurnControl(mockHand, mockTable, mockView, mockTimer);
|
||||
|
||||
testControl.startTurn();
|
||||
|
||||
|
@ -619,7 +621,7 @@ public class TurnControlTest {
|
|||
@Test
|
||||
public void testAddLeft() {
|
||||
AccessibleTable table = new AccessibleTable();
|
||||
TurnControl turnControl = new TurnControl(mockHand, table, mockView,
|
||||
HumanTurnControl turnControl = new HumanTurnControl(mockHand, table, mockView,
|
||||
mockTimer);
|
||||
turnControl.startTurn();
|
||||
Stone blueOne = new Stone(1, BLUE);
|
||||
|
@ -736,7 +738,7 @@ public class TurnControlTest {
|
|||
@Test
|
||||
public void testAddRight() {
|
||||
AccessibleTable table = new AccessibleTable();
|
||||
TurnControl turnControl = new TurnControl(mockHand, table, mockView,
|
||||
HumanTurnControl turnControl = new HumanTurnControl(mockHand, table, mockView,
|
||||
mockTimer);
|
||||
turnControl.startTurn();
|
||||
Stone blueOne = new Stone(1, BLUE);
|
||||
|
@ -853,7 +855,7 @@ public class TurnControlTest {
|
|||
@Test
|
||||
public void testAddNewSet() {
|
||||
AccessibleTable table = new AccessibleTable();
|
||||
TurnControl turnControl = new TurnControl(mockHand, table, mockView,
|
||||
HumanTurnControl turnControl = new HumanTurnControl(mockHand, table, mockView,
|
||||
mockTimer);
|
||||
turnControl.startTurn();
|
||||
Stone blueOne = new Stone(1, BLUE);
|
||||
|
@ -976,7 +978,7 @@ public class TurnControlTest {
|
|||
|
||||
List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>(
|
||||
mockHand.stones);
|
||||
Collections.sort(stones, new TurnControl.HandStonePositionComparator());
|
||||
Collections.sort(stones, new HumanTurnControl.HandStonePositionComparator());
|
||||
|
||||
assertEquals(stones.size(), 13);
|
||||
|
||||
|
@ -1037,7 +1039,7 @@ public class TurnControlTest {
|
|||
|
||||
List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>(
|
||||
mockHand.stones);
|
||||
Collections.sort(stones, new TurnControl.HandStonePositionComparator());
|
||||
Collections.sort(stones, new HumanTurnControl.HandStonePositionComparator());
|
||||
|
||||
assertEquals(stones.size(), 13);
|
||||
|
Reference in a new issue