summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/model
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub/model')
-rw-r--r--test/jrummikub/model/StoneSetTest.java43
1 files changed, 22 insertions, 21 deletions
diff --git a/test/jrummikub/model/StoneSetTest.java b/test/jrummikub/model/StoneSetTest.java
index 196090e..b3d77bd 100644
--- a/test/jrummikub/model/StoneSetTest.java
+++ b/test/jrummikub/model/StoneSetTest.java
@@ -6,6 +6,7 @@ import java.util.List;
import jrummikub.util.Pair;
import static jrummikub.model.StoneColor.*;
+import static jrummikub.model.StoneSet.Type.*;
import org.junit.*;
import static org.junit.Assert.*;
@@ -14,38 +15,38 @@ public class StoneSetTest {
// Is Valid-Test
// valid
- public void assertSet(boolean valid, List<Stone> stones) {
+ public void assertSet(StoneSet.Type expectedType, List<Stone> stones) {
StoneSet set = new StoneSet(stones);
- assertTrue(valid == set.isValid());
+ assertSame(expectedType, set.classify());
}
@Test
public void doubleJoker() {
- assertSet(true, Arrays.asList(new Stone(RED), new Stone(BLACK),
+ assertSet(GROUP, Arrays.asList(new Stone(RED), new Stone(BLACK),
new Stone(1, BLACK)));
}
@Test
public void groups() {
- assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK),
+ assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK),
new Stone(1, BLUE)));
- assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK),
+ assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK),
new Stone(1, BLUE), new Stone(1, ORANGE)));
}
@Test
public void runs() {
- assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(2, RED),
+ assertSet(RUN, Arrays.asList(new Stone(1, RED), new Stone(2, RED),
new Stone(3, RED)));
- assertSet(true, Arrays.asList(new Stone(4, BLUE), new Stone(5, BLUE),
+ assertSet(RUN, Arrays.asList(new Stone(4, BLUE), new Stone(5, BLUE),
new Stone(6, BLUE)));
}
@Test
public void singleJoker() {
- assertSet(true, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK),
+ assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK),
new Stone(RED)));
- assertSet(true, Arrays.asList(new Stone(2, RED), new Stone(3, RED),
+ assertSet(RUN, Arrays.asList(new Stone(2, RED), new Stone(3, RED),
new Stone(BLACK)));
}
@@ -53,41 +54,41 @@ public class StoneSetTest {
@Test
public void outOfBounds() {
- assertSet(false, Arrays.asList(new Stone(RED), new Stone(1, RED),
+ assertSet(INVALID, Arrays.asList(new Stone(RED), new Stone(1, RED),
new Stone(2, RED)));
- assertSet(false, Arrays.asList(new Stone(12, RED), new Stone(13, RED),
+ assertSet(INVALID, Arrays.asList(new Stone(12, RED), new Stone(13, RED),
new Stone(RED)));
- assertSet(false, Arrays.asList(new Stone(RED), new Stone(BLACK),
+ assertSet(INVALID, Arrays.asList(new Stone(RED), new Stone(BLACK),
new Stone(1, RED), new Stone(2, RED)));
}
@Test
public void sameColor() {
- assertSet(false, Arrays.asList(new Stone(1, RED), new Stone(1, RED),
+ assertSet(INVALID, Arrays.asList(new Stone(1, RED), new Stone(1, RED),
new Stone(1, BLUE)));
- assertSet(false, Arrays.asList(new Stone(1, RED), new Stone(1, BLUE),
+ assertSet(INVALID, Arrays.asList(new Stone(1, RED), new Stone(1, BLUE),
new Stone(1, BLACK), new Stone(1, ORANGE), new Stone(RED)));
}
@Test
public void incorrectOrder() {
- assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(6, RED),
+ assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(6, RED),
new Stone(5, RED)));
- assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(6, RED),
+ assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(6, RED),
new Stone(RED)));
- assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(RED),
+ assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(RED),
new Stone(5, RED)));
}
@Test
public void otherInvalid() {
- assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(5, RED),
+ assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, RED),
new Stone(7, RED)));
- assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(5, BLUE),
+ assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, BLUE),
new Stone(6, RED)));
- assertSet(false, Arrays.asList(new Stone(4, RED), new Stone(5, RED)));
- assertSet(false, Arrays.asList(new Stone(4, BLUE), new Stone(5, RED),
+ assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, RED)));
+ assertSet(INVALID, Arrays.asList(new Stone(4, BLUE), new Stone(5, RED),
new Stone(6, RED)));
}