diff options
Diffstat (limited to 'test/jrummikub/model/StoneSetTest.java')
-rw-r--r-- | test/jrummikub/model/StoneSetTest.java | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/test/jrummikub/model/StoneSetTest.java b/test/jrummikub/model/StoneSetTest.java index e7998e4..b98d3d8 100644 --- a/test/jrummikub/model/StoneSetTest.java +++ b/test/jrummikub/model/StoneSetTest.java @@ -22,8 +22,8 @@ public class StoneSetTest { @Test public void doubleJoker() { - assertSet(GROUP, Arrays.asList(new Stone(RED), new Stone(BLACK), - new Stone(1, BLACK))); + assertSet(GROUP, + Arrays.asList(new Stone(RED), new Stone(BLACK), new Stone(1, BLACK))); } @Test @@ -36,62 +36,63 @@ public class StoneSetTest { @Test public void runs() { - assertSet(RUN, Arrays.asList(new Stone(1, RED), new Stone(2, RED), - new Stone(3, RED))); + assertSet(RUN, + Arrays.asList(new Stone(1, RED), new Stone(2, RED), new Stone(3, RED))); assertSet(RUN, Arrays.asList(new Stone(4, BLUE), new Stone(5, BLUE), new Stone(6, BLUE))); } @Test public void singleJoker() { - assertSet(GROUP, Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), - new Stone(RED))); - assertSet(RUN, Arrays.asList(new Stone(2, RED), new Stone(3, RED), - new Stone(BLACK))); + assertSet(GROUP, + Arrays.asList(new Stone(1, RED), new Stone(1, BLACK), new Stone(RED))); + assertSet(RUN, + Arrays.asList(new Stone(2, RED), new Stone(3, RED), new Stone(BLACK))); } // 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, Arrays.asList(new Stone(1, RED), new Stone(1, RED), - new Stone(1, BLUE))); + assertSet(INVALID, + Arrays.asList(new Stone(1, RED), 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(INVALID, Arrays.asList(new Stone(4, RED), new Stone(6, RED), - new Stone(5, RED))); - assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(6, RED), - new Stone(RED))); - assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(RED), - new Stone(5, RED))); + assertSet(INVALID, + Arrays.asList(new Stone(4, RED), new Stone(6, RED), new Stone(5, RED))); + assertSet(INVALID, + Arrays.asList(new Stone(4, RED), new Stone(6, RED), new Stone(RED))); + assertSet(INVALID, + Arrays.asList(new Stone(4, RED), new Stone(RED), new Stone(5, RED))); } @Test public void otherInvalid() { - assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, RED), - new Stone(7, RED))); - assertSet(INVALID, Arrays.asList(new Stone(4, RED), new Stone(5, BLUE), - new Stone(6, RED))); + assertSet(INVALID, + Arrays.asList(new Stone(4, RED), new Stone(5, RED), new Stone(7, RED))); + assertSet(INVALID, + Arrays.asList(new Stone(4, RED), new Stone(5, BLUE), new Stone(6, 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))); + 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 @@ -159,4 +160,14 @@ public class StoneSetTest { assertEquals(i, testSet.size()); } + + @Test + public void testToString() { + StoneSet testSet = new StoneSet(Arrays.asList(new Stone(2, BLUE), + new Stone(3, BLUE), new Stone(4, BLUE))); + + assertEquals( + "StoneSet[Stone[value=2,color=BLUE],Stone[value=3,color=BLUE],Stone[value=4,color=BLUE]]", + testSet.toString()); + } } |