Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. /* $Id$ */
  2. /***************************************************************************
  3. * (C) Copyright 2003-2010 - Stendhal *
  4. ***************************************************************************
  5. ***************************************************************************
  6. * *
  7. * This program is free software; you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation; either version 2 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. ***************************************************************************/
  13. package games.stendhal.server.entity.npc;
  14.  
  15. import static org.junit.Assert.assertEquals;
  16. import static org.junit.Assert.assertTrue;
  17. import static utilities.SpeakerNPCTestHelper.getReply;
  18.  
  19. import org.junit.BeforeClass;
  20. import org.junit.Test;
  21.  
  22. import games.stendhal.server.entity.npc.fsm.Engine;
  23. import utilities.ZonePlayerAndNPCTestImpl;
  24. /**
  25. * Test NPC is in the game.
  26. *
  27. * @author Bozhidar Nedelchev
  28. */
  29. public class NewsGuyNPC extends ZonePlayerAndNPCTestImpl {
  30.  
  31. private static final String ZONE_NAME = "0_deniran";
  32.  
  33. @BeforeClass
  34. public static void setUpBeforeClass() throws Exception {
  35. setupZone(ZONE_NAME);
  36. }
  37.  
  38. public NewsGuyNPC() {
  39. setNpcNames("Mr News Guy");
  40. setZoneForPlayer(ZONE_NAME);
  41. }
  42.  
  43. /**
  44. * Tests for hiAndBye.
  45. */
  46. @Test
  47. public void testHiAndBye() {
  48. final SpeakerNPC npc = getNPC("Mr News Guy");
  49. final Engine en = npc.getEngine();
  50.  
  51. assertTrue(en.step(player, "hi"));
  52. assertEquals("Greetings! How may I help you?", getReply(npc));
  53.  
  54. assertTrue(en.step(player, "bye"));
  55. assertEquals("Bye.", getReply(npc));
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement