From: Astrid S. <ast...@us...> - 2008-01-14 09:49:03
|
Update of /cvsroot/arianne/stendhal/tests/games/stendhal/server/maps/quests In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv17274/tests/games/stendhal/server/maps/quests Modified Files: HatForMonogenesTest.java Log Message: coverage=100 Index: HatForMonogenesTest.java =================================================================== RCS file: /cvsroot/arianne/stendhal/tests/games/stendhal/server/maps/quests/HatForMonogenesTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HatForMonogenesTest.java 13 Jan 2008 20:39:17 -0000 1.4 --- HatForMonogenesTest.java 14 Jan 2008 09:49:06 -0000 1.5 *************** *** 4,7 **** --- 4,8 ---- import games.stendhal.server.core.config.ZoneConfigurator; import games.stendhal.server.core.engine.StendhalRPZone; + import games.stendhal.server.core.rule.defaultruleset.DefaultEntityManager; import games.stendhal.server.entity.item.Item; import games.stendhal.server.entity.npc.NPCList; *************** *** 13,16 **** --- 14,20 ---- import games.stendhal.server.maps.semos.tavern.TraderNPC; + import java.util.ArrayList; + import java.util.List; + import org.junit.Before; import org.junit.BeforeClass; *************** *** 23,31 **** public class HatForMonogenesTest { ! private Player player = null; ! private SpeakerNPC npc = null; ! private Engine en = null; ! private SpeakerNPC npcXin = null; ! private Engine enXin = null; @BeforeClass --- 27,35 ---- public class HatForMonogenesTest { ! ! private SpeakerNPC npc; ! private Engine en; ! private SpeakerNPC npcXin; ! private Engine enXin; @BeforeClass *************** *** 52,64 **** quest.addToWorld(); ! player = PlayerTestHelper.createPlayer("player"); } @Test public void testQuest() { en.step(player, "hi"); ! assertEquals("Hello there, stranger! Don't be too intimidated if people are quiet and reserved... the fear of Blordrough and his forces has spread all over the country, and we're all a bit concerned. I can offer a few tips on socializing though, would you like to hear them?", npc.get("text")); en.step(player, "no"); ! assertEquals("And how are you supposed to know what's happening? By reading the Semos Tribune? Hah! Bye, then.", npc.get("text")); // ----------------------------------------------- --- 56,73 ---- quest.addToWorld(); ! } @Test public void testQuest() { + Player player = PlayerTestHelper.createPlayer("player"); en.step(player, "hi"); ! assertEquals( ! "Hello there, stranger! Don't be too intimidated if people are quiet and reserved... the fear of Blordrough and his forces has spread all over the country, and we're all a bit concerned. I can offer a few tips on socializing though, would you like to hear them?", ! npc.get("text")); en.step(player, "no"); ! assertEquals( ! "And how are you supposed to know what's happening? By reading the Semos Tribune? Hah! Bye, then.", ! npc.get("text")); // ----------------------------------------------- *************** *** 67,75 **** assertEquals("Hi again, player. How can I #help you this time?", npc.get("text")); en.step(player, "task"); ! assertEquals("Could you bring me a #hat to cover my bald head? Brrrrr! The days here in Semos are really getting colder...", npc.get("text")); en.step(player, "hat"); ! assertEquals("You don't know what a hat is?! Anything light that can cover my head; like leather, for instance. Now, will you do it?", npc.get("text")); en.step(player, "no"); ! assertEquals("You surely have more importants things to do, and little time to do them in. I'll just stay here and freeze to death, I guess... *sniff*", npc.get("text")); en.step(player, "bye"); assertEquals("Bye.", npc.get("text")); --- 76,90 ---- assertEquals("Hi again, player. How can I #help you this time?", npc.get("text")); en.step(player, "task"); ! assertEquals( ! "Could you bring me a #hat to cover my bald head? Brrrrr! The days here in Semos are really getting colder...", ! npc.get("text")); en.step(player, "hat"); ! assertEquals( ! "You don't know what a hat is?! Anything light that can cover my head; like leather, for instance. Now, will you do it?", ! npc.get("text")); en.step(player, "no"); ! assertEquals( ! "You surely have more importants things to do, and little time to do them in. I'll just stay here and freeze to death, I guess... *sniff*", ! npc.get("text")); en.step(player, "bye"); assertEquals("Bye.", npc.get("text")); *************** *** 80,86 **** assertEquals("Hi again, player. How can I #help you this time?", npc.get("text")); en.step(player, "task"); ! assertEquals("Could you bring me a #hat to cover my bald head? Brrrrr! The days here in Semos are really getting colder...", npc.get("text")); en.step(player, "hat"); ! assertEquals("You don't know what a hat is?! Anything light that can cover my head; like leather, for instance. Now, will you do it?", npc.get("text")); en.step(player, "yes"); assertEquals("Thanks, my good friend. I'll be waiting here for your return!", npc.get("text")); --- 95,105 ---- assertEquals("Hi again, player. How can I #help you this time?", npc.get("text")); en.step(player, "task"); ! assertEquals( ! "Could you bring me a #hat to cover my bald head? Brrrrr! The days here in Semos are really getting colder...", ! npc.get("text")); en.step(player, "hat"); ! assertEquals( ! "You don't know what a hat is?! Anything light that can cover my head; like leather, for instance. Now, will you do it?", ! npc.get("text")); en.step(player, "yes"); assertEquals("Thanks, my good friend. I'll be waiting here for your return!", npc.get("text")); *************** *** 111,120 **** en.step(player, "hi"); assertEquals("Hey! Is that leather hat for me?", npc.get("text")); en.step(player, "yes"); ! // [22:40] player earns 10 experience points. assertEquals("Bless you, my good friend! Now my head will stay nice and warm.", npc.get("text")); en.step(player, "bye"); assertEquals("Bye.", npc.get("text")); ! // (sorry i meant to put it on ground to test if he noticed it went missing, i did, but i forgot i had one on my head too, he took that.) } } --- 130,198 ---- en.step(player, "hi"); assertEquals("Hey! Is that leather hat for me?", npc.get("text")); + npc.remove("text"); + player.drop("leather helmet"); + int oldXP = player.getXP(); en.step(player, "yes"); ! assertEquals(oldXP, player.getXP()); ! assertEquals(null, npc.get("text")); ! en.step(player, "bye"); ! assertEquals("Bye.", npc.get("text")); ! ! // ----------------------------------------------- ! ! en.step(player, "hi"); ! assertEquals( ! "Hey, my good friend, remember that leather hat I asked you about before? It's still pretty chilly here...", ! npc.get("text")); ! en.step(player, "bye"); ! assertEquals("Bye.", npc.get("text")); ! ! // ----------------------------------------------- ! ! player.equip("bag", DefaultEntityManager.getInstance().getItem("leather helmet")); ! en.step(player, "hi"); ! assertEquals("Hey! Is that leather hat for me?", npc.get("text")); ! oldXP = player.getXP(); ! en.step(player, "yes"); ! assertEquals(oldXP + 10, player.getXP()); ! assertEquals("Bless you, my good friend! Now my head will stay nice and warm.", npc.get("text")); en.step(player, "bye"); assertEquals("Bye.", npc.get("text")); ! // (sorry i meant to put it on ground to test if he noticed it went ! // missing, i did, but i forgot i had one on my head too, he took that.) ! } ! ! @Test ! public void testGetHistory() { ! HatForMonogenes quest = new HatForMonogenes(); ! Player player = PlayerTestHelper.createPlayer("bob"); ! List<String> history = new ArrayList<String>(); ! assertEquals(history, quest.getHistory(player)); ! ! ! player.setQuest("hat_monogenes", ""); ! history.add("FIRST_CHAT"); ! history.add("GET_HAT"); ! assertEquals(history, quest.getHistory(player)); ! ! player.equip("bag", ItemTestHelper.createItem("leather hat")); ! history.add("GOT_HAT"); ! ! assertEquals(history, quest.getHistory(player)); ! player.setQuest("hat_monogenes", "done"); ! history.add("DONE"); ! ! assertEquals(history, quest.getHistory(player)); ! } + + @Test + public void testinit() { + HatForMonogenes quest = new HatForMonogenes(); + quest.init("bla"); + assertEquals("bla", quest.getName()); + } + + } |