From edf4197c1644f22f29ec4135fc6cbee4eb37d056 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Mon, 16 May 2011 19:07:46 +0200 Subject: Tests for new hand wrapping git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@239 72836036-5685-4462-b002-a69064685172 --- test/jrummikub/model/HandTest.java | 41 ++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'test/jrummikub/model') diff --git a/test/jrummikub/model/HandTest.java b/test/jrummikub/model/HandTest.java index 46aa978..fbe694b 100644 --- a/test/jrummikub/model/HandTest.java +++ b/test/jrummikub/model/HandTest.java @@ -3,8 +3,12 @@ package jrummikub.model; import static jrummikub.model.StoneColor.*; import static org.junit.Assert.assertEquals; +import java.util.ArrayList; +import java.util.List; + import org.junit.Before; import org.junit.Test; + /** * Test class for {@link Hand} */ @@ -91,27 +95,20 @@ public class HandTest { /** */ @Test - public void testRightWrapDrop() { - Stone stone1 = new Stone(12, ORANGE); - Stone stone2 = new Stone(13, ORANGE); - - hand.drop(stone1, new Position(13, 0)); - hand.drop(stone2, new Position(12.5f, 0)); - - assertEquals(new Position(0, 1), hand.getPosition(stone1)); - assertEquals(new Position(12.5f, 0), hand.getPosition(stone2)); - } - - /** */ - @Test - public void testLeftWrapDrop() { - Stone stone1 = new Stone(1, ORANGE); - Stone stone2 = new Stone(2, ORANGE); - - hand.drop(stone1, new Position(0, 1)); - hand.drop(stone2, new Position(0.25f, 1)); - - assertEquals(new Position(13, 0), hand.getPosition(stone1)); - assertEquals(new Position(0.25f, 1), hand.getPosition(stone2)); + public void testFullWrapDrop() { + List rowStones = new ArrayList(); + for (int i = 0; i < 14; i++) { + Stone stone = new Stone(i % 9, BLUE); + rowStones.add(stone); + hand.drop(stone, new Position(i, 1)); + } + Stone newStone = new Stone(RED); + hand.drop(newStone, new Position(12.5f, 1)); + + for (int i = 0; i < 13; i++) { + assertEquals(new Position(i, 1), hand.getPosition(rowStones.get(i))); + } + assertEquals(new Position(13, 1), hand.getPosition(newStone)); + assertEquals(new Position(0, 2), hand.getPosition(rowStones.get(13))); } } -- cgit v1.2.3