summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/model
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-05-08 22:46:31 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-05-08 22:46:31 +0200
commitec2936a034c845d2c1e561ee1bc1860be0964933 (patch)
tree8049144cb0b9dc26ab0ca0f6529b86595025ed4c /test/jrummikub/model
parent35cd080bcdea6e0df1f1ff66caacf1fee6fc50d4 (diff)
downloadJRummikub-ec2936a034c845d2c1e561ee1bc1860be0964933.tar
JRummikub-ec2936a034c845d2c1e561ee1bc1860be0964933.zip
Zwischencommit weil Ida so müde ist, eigentlich nichts passiert
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@177 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/model')
-rw-r--r--test/jrummikub/model/TableTest.java56
1 files changed, 35 insertions, 21 deletions
diff --git a/test/jrummikub/model/TableTest.java b/test/jrummikub/model/TableTest.java
index 36d2a22..44605e2 100644
--- a/test/jrummikub/model/TableTest.java
+++ b/test/jrummikub/model/TableTest.java
@@ -14,70 +14,84 @@ import org.junit.Test;
public class TableTest {
Table testTable;
-
+
@Before
public void setup() {
testTable = new Table();
}
-
+
@Test
public void testIsValid() {
- testTable.drop(new StoneSet(Arrays.asList(new Stone(RED), new Stone(BLACK),
- new Stone(1, BLACK))), new Position(0,0));
- testTable.drop(new StoneSet(Arrays.asList(new Stone(1, RED), new Stone(2, RED),
- new Stone(3, RED))), new Position(0,0));
+ testTable.drop(
+ new StoneSet(Arrays.asList(new Stone(RED), new Stone(BLACK),
+ new Stone(1, BLACK))), new Position(0, 0));
+ testTable.drop(
+ new StoneSet(Arrays.asList(new Stone(1, RED),
+ new Stone(2, RED), new Stone(3, RED))), new Position(0,
+ 0));
assertTrue(testTable.isValid());
- testTable.drop(new StoneSet(Arrays.asList(new Stone(5, RED))), new Position(0,0));
+ testTable.drop(new StoneSet(Arrays.asList(new Stone(5, RED))),
+ new Position(0, 0));
assertFalse(testTable.isValid());
}
-
+
@Test
public void testEmptyIsValid() {
assertTrue(testTable.isValid());
}
-
+
@Test
@SuppressWarnings("unused")
public void testPickUpStoneGroup() {
Stone targetStone = new Stone(BLACK);
- testTable.drop(new StoneSet(Arrays.asList(new Stone(RED), targetStone,
- new Stone(1, BLACK))), new Position(0,0));
+ testTable.drop(
+ new StoneSet(Arrays.asList(new Stone(RED), targetStone,
+ new Stone(1, BLACK))), new Position(0, 0));
assertTrue(testTable.isValid());
testTable.pickUpStone(targetStone);
assertFalse(testTable.isValid());
-
+
int counter = 0;
for (Object i : testTable) {
counter++;
}
assertEquals(1, counter);
}
-
+
+ @Test
+ public void testPickLonelyStone() {
+ Stone targetStone = new Stone(BLACK);
+ testTable.drop(new StoneSet(targetStone), new Position(0, 0));
+ testTable.pickUpStone(targetStone);
+ assertEquals(0, testTable.getSize());
+ }
+
@Test
@SuppressWarnings("unused")
public void testPickUpStoneRun() {
Stone targetStone = new Stone(BLACK);
- testTable.drop(new StoneSet(Arrays.asList(new Stone(1, RED), targetStone,
- new Stone(3, RED))), new Position(0,0));
+ testTable.drop(
+ new StoneSet(Arrays.asList(new Stone(1, RED), targetStone,
+ new Stone(3, RED))), new Position(0, 0));
assertTrue(testTable.isValid());
testTable.pickUpStone(targetStone);
assertFalse(testTable.isValid());
-
+
int counter = 0;
for (Object i : testTable) {
counter++;
}
assertEquals(2, counter);
}
-
+
@Test
public void testFindSet() {
Stone targetStone = new Stone(BLACK);
- StoneSet testSet = new StoneSet(Arrays.asList(new Stone(1, RED), targetStone,
- new Stone(3, RED)));
- testTable.drop(testSet, new Position(0,0));
-
+ StoneSet testSet = new StoneSet(Arrays.asList(new Stone(1, RED),
+ targetStone, new Stone(3, RED)));
+ testTable.drop(testSet, new Position(0, 0));
+
StoneSet foundSet = testTable.findStoneSet(targetStone);
assertSame(testSet, foundSet);
}