From: Martin F. <mar...@us...> - 2011-04-30 07:58:32
|
Update of /cvsroot/arianne/stendhal/tests/games/stendhal/server/maps/quests In directory vz-cvs-4.sog:/tmp/cvs-serv24361/tests/games/stendhal/server/maps/quests Modified Files: SellingTest.java Log Message: add test case for selling lion shields Index: SellingTest.java =================================================================== RCS file: /cvsroot/arianne/stendhal/tests/games/stendhal/server/maps/quests/SellingTest.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** SellingTest.java 5 Apr 2011 20:27:46 -0000 1.25 --- SellingTest.java 30 Apr 2011 07:58:30 -0000 1.26 *************** *** 30,34 **** /** ! * Test selling cheese to the bar maid. * * @author Martin Fuchs --- 30,34 ---- /** ! * Tests for the seller behaviour. * * @author Martin Fuchs *************** *** 187,191 **** */ @Test ! public void testSellShields() { final SpeakerNPC npc = getNPC("McPegleg"); final Engine en = npc.getEngine(); --- 187,191 ---- */ @Test ! public void testSellPlateShields() { final SpeakerNPC npc = getNPC("McPegleg"); final Engine en = npc.getEngine(); *************** *** 233,236 **** --- 233,274 ---- assertTrue(player.isEquipped("money", 5)); assertFalse(player.isEquipped("plate shield", 1)); + + assertTrue(en.step(player, "bye")); + assertEquals("I see you!", getReply(npc)); + } + + /** + * Tests for selling enhanced lion plate shields. + */ + @Test + public void testSellLionShield() { + final SpeakerNPC npc = getNPC("McPegleg"); + final Engine en = npc.getEngine(); + + assertTrue(en.step(player, "hi")); + assertEquals("Yo matey! You look like you need #help.", getReply(npc)); + + assertTrue(en.step(player, "sell lion shield")); + assertEquals("A lion shield is worth 50. Do you want to sell it?", getReply(npc)); + + assertTrue(en.step(player, "yes")); + assertEquals("Sorry! You don't have any lion shield.", getReply(npc)); + + // equip the player with a lion shield to be sold + assertFalse(player.isEquipped("lion shield", 1)); + assertTrue(equipWithItem(player, "lion shield")); + assertTrue(player.isEquipped("lion shield", 1)); + + assertTrue(en.step(player, "sell enhanced lion shield")); + assertEquals("A lion shield is worth 50. Do you want to sell it?", getReply(npc)); + + // ensure we currently don't have any money + assertFalse(player.isEquipped("money", 1)); + + assertTrue(en.step(player, "yes")); + assertEquals("Thanks! Here is your money.", getReply(npc)); + + assertTrue(en.step(player, "bye")); + assertEquals("I see you!", getReply(npc)); } } |