summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/model/StoneSetTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub/model/StoneSetTest.java')
-rw-r--r--test/jrummikub/model/StoneSetTest.java34
1 files changed, 24 insertions, 10 deletions
diff --git a/test/jrummikub/model/StoneSetTest.java b/test/jrummikub/model/StoneSetTest.java
index b98d3d8..2575f22 100644
--- a/test/jrummikub/model/StoneSetTest.java
+++ b/test/jrummikub/model/StoneSetTest.java
@@ -11,21 +11,25 @@ import static jrummikub.model.StoneSet.Type.*;
import org.junit.*;
import static org.junit.Assert.*;
+/**
+ * Tests for {@link StoneSet}
+ */
public class StoneSetTest {
- // Is Valid-Test
- // valid
- public void assertSet(StoneSet.Type expectedType, List<Stone> stones) {
+ private void assertSet(StoneSet.Type expectedType, List<Stone> stones) {
StoneSet set = new StoneSet(stones);
assertSame(expectedType, set.classify());
}
+ // valid
+ /** */
@Test
public void doubleJoker() {
assertSet(GROUP,
Arrays.asList(new Stone(RED), new Stone(BLACK), new Stone(1, BLACK)));
}
+ /** */
@Test
public void groups() {
assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK),
@@ -34,6 +38,7 @@ public class StoneSetTest {
new Stone(1, BLUE), new Stone(1, ORANGE)));
}
+ /** */
@Test
public void runs() {
assertSet(RUN,
@@ -42,6 +47,7 @@ public class StoneSetTest {
new Stone(6, BLUE)));
}
+ /** */
@Test
public void singleJoker() {
assertSet(GROUP,
@@ -51,17 +57,18 @@ public class StoneSetTest {
}
// invalid
-
+ /** */
@Test
public void outOfBounds() {
- assertSet(INVALID,
- Arrays.asList(new Stone(RED), new Stone(1, RED), new Stone(2, RED)));
- assertSet(INVALID,
- Arrays.asList(new Stone(12, RED), new Stone(13, RED), new Stone(RED)));
+ assertSet(INVALID, Arrays.asList(new Stone(RED), new Stone(1, RED),
+ new Stone(2, RED)));
+ assertSet(INVALID, Arrays.asList(new Stone(12, RED),
+ new Stone(13, RED), new Stone(RED)));
assertSet(INVALID, Arrays.asList(new Stone(RED), new Stone(BLACK),
new Stone(1, RED), new Stone(2, RED)));
}
+ /** */
@Test
public void sameColor() {
assertSet(INVALID,
@@ -70,6 +77,7 @@ public class StoneSetTest {
new Stone(1, BLACK), new Stone(1, ORANGE), new Stone(RED)));
}
+ /** */
@Test
public void incorrectOrder() {
assertSet(INVALID,
@@ -80,6 +88,7 @@ public class StoneSetTest {
Arrays.asList(new Stone(4, RED), new Stone(RED), new Stone(5, RED)));
}
+ /** */
@Test
public void otherInvalid() {
@@ -91,11 +100,12 @@ public class StoneSetTest {
assertSet(INVALID,
Arrays.asList(new Stone(4, BLUE), new Stone(5, RED), new Stone(6, RED)));
// Regression test:
- assertSet(INVALID, Arrays.asList(new Stone(12, ORANGE),
- new Stone(12, BLACK), new Stone(7, BLUE)));
+ assertSet(INVALID, Arrays.asList(new Stone(12, ORANGE), new Stone(12,
+ BLACK), new Stone(7, BLUE)));
}
// invalid Split
+ /** */
@Test
public void testSplitInvalidLow() {
StoneSet testSet = createTestSet();
@@ -103,6 +113,7 @@ public class StoneSetTest {
}
+ /** */
@Test
public void testSplitInvalidHigh() {
StoneSet testSet = createTestSet();
@@ -110,6 +121,7 @@ public class StoneSetTest {
}
// valid Split
+ /** */
@Test
public void testSplitValid() {
StoneSet testSet = createTestSet();
@@ -133,6 +145,7 @@ public class StoneSetTest {
}
// join
+ /** */
@Test
public void testJoin() {
StoneSet testSet = createTestSet();
@@ -148,6 +161,7 @@ public class StoneSetTest {
}
// iterator
+ /** */
@Test
public void testIterator() {
StoneSet testSet = createTestSet();