From: Astrid S. <ast...@us...> - 2008-06-23 10:47:18
|
Update of /cvsroot/arianne/stendhal/tests/games/stendhal/server/entity/item In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv7558/tests/games/stendhal/server/entity/item Modified Files: ItemTest.java Log Message: adding isBound and isBoundTo(Player) to Item and make use of them Index: ItemTest.java =================================================================== RCS file: /cvsroot/arianne/stendhal/tests/games/stendhal/server/entity/item/ItemTest.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ItemTest.java 27 Jan 2008 22:03:43 -0000 1.31 --- ItemTest.java 23 Jun 2008 10:47:25 -0000 1.32 *************** *** 1,8 **** --- 1,11 ---- package games.stendhal.server.entity.item; + import static org.hamcrest.Matchers.is; + import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; + import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import games.stendhal.server.core.engine.StendhalRPZone; *************** *** 288,290 **** --- 291,311 ---- } + @Test + public void testGetBoundTo() { + Item mo = new Item("name1", "myClass", "mySubclass", + new HashMap<String, String>()); + assertNull(mo.getBoundTo()); + mo.setBoundTo("bob"); + assertTrue(mo.isBound()); + assertTrue(mo.isBoundTo(PlayerTestHelper.createPlayer("bob"))); + assertEquals("bob", mo.getBoundTo()); + + mo.setBoundTo(null); + assertFalse(mo.isBound()); + assertFalse(mo.isBoundTo(PlayerTestHelper.createPlayer("bob"))); + assertThat(mo.getBoundTo(), not(is("bob"))); + } + + + } |