pickUp(object) in StoneTray implementiert und getestet
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@78 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
42a8b91c4d
commit
2b09ff6ec5
2 changed files with 20 additions and 0 deletions
|
@ -209,4 +209,11 @@ public class StoneTray<E extends Sizeable> implements
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
|
public void pickUp(E object) {
|
||||||
|
objects.remove(object);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@ public class StoneTrayTest {
|
||||||
assertEquals(1, thirdPosition.getY(), 0.00001);
|
assertEquals(1, thirdPosition.getY(), 0.00001);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrongPickUp() {
|
public void testWrongPickUp() {
|
||||||
Thing firstThing = new Thing(5, 5);
|
Thing firstThing = new Thing(5, 5);
|
||||||
|
@ -138,6 +139,18 @@ public class StoneTrayTest {
|
||||||
Position testPosition = new Position(-2, -2);
|
Position testPosition = new Position(-2, -2);
|
||||||
assertNull(testTray.pickUp(testPosition));
|
assertNull(testTray.pickUp(testPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPickUpByObject() {
|
||||||
|
Thing firstThing = new Thing(5,5);
|
||||||
|
testTray.drop(firstThing, new Position(0, 0));
|
||||||
|
Thing secondThing = new Thing(5,5);
|
||||||
|
testTray.drop(secondThing, new Position(5, 0));
|
||||||
|
testTray.pickUp(firstThing);
|
||||||
|
for (Pair<Thing, Position> i : testTray) {
|
||||||
|
assertSame(i.getFirst(), secondThing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRightPickUp() {
|
public void testRightPickUp() {
|
||||||
|
|
Reference in a new issue