Fix StoneTrayTest
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@105 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
c9843770dd
commit
4870017d27
1 changed files with 11 additions and 14 deletions
|
@ -49,10 +49,10 @@ public class StoneTrayTest {
|
|||
assertEquals(42, secondPosition.getX(), 0.00001);
|
||||
assertEquals(8.5, secondPosition.getY(), 0.00001);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDropNull() {
|
||||
testTray.drop(null, new Position(0,0));
|
||||
testTray.drop(null, new Position(0, 0));
|
||||
assertFalse(testTray.iterator().hasNext());
|
||||
}
|
||||
|
||||
|
@ -115,15 +115,15 @@ public class StoneTrayTest {
|
|||
assertEquals(1, secondPosition.getX(), 0.00001);
|
||||
assertEquals(-2, secondPosition.getY(), 0.00001);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDoubleShift() {
|
||||
Thing firstThing = new Thing(5, 5);
|
||||
testTray.drop(firstThing, new Position(0, 0));
|
||||
|
||||
|
||||
Thing secondThing = new Thing(5, 0.1f);
|
||||
testTray.drop(secondThing, new Position(5, 0));
|
||||
|
||||
|
||||
Thing thirdThing = new Thing(3, 3);
|
||||
testTray.drop(thirdThing, new Position(-2, 1));
|
||||
Position firstPosition = testTray.getPosition(firstThing);
|
||||
|
@ -137,7 +137,6 @@ public class StoneTrayTest {
|
|||
assertEquals(1, thirdPosition.getY(), 0.00001);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testWrongPickUp() {
|
||||
Thing firstThing = new Thing(5, 5);
|
||||
|
@ -145,12 +144,12 @@ public class StoneTrayTest {
|
|||
Position testPosition = new Position(-2, -2);
|
||||
assertNull(testTray.pickUp(testPosition));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPickUpByObject() {
|
||||
Thing firstThing = new Thing(5,5);
|
||||
Thing firstThing = new Thing(5, 5);
|
||||
testTray.drop(firstThing, new Position(0, 0));
|
||||
Thing secondThing = new Thing(5,5);
|
||||
Thing secondThing = new Thing(5, 5);
|
||||
testTray.drop(secondThing, new Position(5, 0));
|
||||
testTray.pickUp(firstThing);
|
||||
for (Pair<Thing, Position> i : testTray) {
|
||||
|
@ -169,7 +168,6 @@ public class StoneTrayTest {
|
|||
assertSame(testTray.pickUp(testPosition), firstThing);
|
||||
assertNull(testTray.pickUp(testPosition));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testIterate() {
|
||||
|
@ -192,22 +190,21 @@ public class StoneTrayTest {
|
|||
assertTrue(testThings.isEmpty());
|
||||
assertTrue(testPositions.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testClone() {
|
||||
Thing firstThing = new Thing(5, 5);
|
||||
testTray.drop(firstThing, new Position(0, 0));
|
||||
Thing secondThing = new Thing(3, 3);
|
||||
testTray.drop(secondThing, new Position(-5, -5));
|
||||
StoneTray<Thing> trayCopy = testTray.clone();
|
||||
|
||||
IStoneTray<Thing> trayCopy = testTray.clone();
|
||||
|
||||
testTray.pickUp(firstThing);
|
||||
for (Pair<Thing, Position> i : testTray) {
|
||||
assertSame(i.getFirst(), secondThing);
|
||||
}
|
||||
assertTrue(testTray.iterator().hasNext());
|
||||
|
||||
|
||||
trayCopy.pickUp(secondThing);
|
||||
for (Pair<Thing, Position> i : trayCopy) {
|
||||
assertSame(i.getFirst(), firstThing);
|
||||
|
|
Reference in a new issue