From: Hendrik B. <nh...@us...> - 2009-11-01 23:06:10
|
Update of /cvsroot/arianne/stendhal/tests/games/stendhal/server/entity/item In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15588/tests/games/stendhal/server/entity/item Modified Files: ItemTest.java Log Message: added tests for describe() Index: ItemTest.java =================================================================== RCS file: /cvsroot/arianne/stendhal/tests/games/stendhal/server/entity/item/ItemTest.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ItemTest.java 10 Jun 2009 13:28:00 -0000 1.42 --- ItemTest.java 1 Nov 2009 23:05:57 -0000 1.43 *************** *** 1,4 **** --- 1,5 ---- package games.stendhal.server.entity.item; + import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; *************** *** 20,26 **** import marauroa.common.game.RPObject; - import org.junit.After; - import org.junit.AfterClass; - import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; --- 21,24 ---- *************** *** 41,56 **** } - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - @Test public void testGetName() { --- 39,42 ---- *************** *** 93,97 **** @Test ! public void testDescribe() { final Item mo = new Item("name1", "class", "subclass", new HashMap<String, String>()); --- 79,83 ---- @Test ! public void testGetDescription() { final Item mo = new Item("name1", "class", "subclass", new HashMap<String, String>()); *************** *** 99,102 **** --- 85,109 ---- } + + @Test + public void testDescribe() { + final Item item = new Item("name1", "class", "subclass", + new HashMap<String, String>()); + assertThat(item.describe(), equalTo("You see a name1.")); + + item.setDescription("Description."); + item.setBoundTo("hero"); + item.put("min_level", 1); + item.put("atk", 2); + item.put("def", 3); + item.put("rate", 4); + item.put("amount", 5); + item.put("range", 6); + item.put("lifesteal", 7); + + assertThat(item.describe(), equalTo("Description. It is a special quest reward for hero, and cannot be used by others. It requires level 1 to be used to the full benefit. Stats are (ATK: 2 DEF: 3 RATE: 4 HP: 5 RANGE: 6 LIFESTEAL: 7).")); + } + + @Test public void testItemStringStringStringMapOfStringString() { *************** *** 329,334 **** assertThat(mo.getBoundTo(), not(is("bob"))); } - - - } --- 336,338 ---- |