Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This is a test for the bomb squad game
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class TestClass
- {
- // field for player1
- Player player1;
- Room room1;
- Item item1;
- /**
- * Constructor for objects of class TestClass
- */
- public TestClass()
- {
- // initialise instance variables
- player1 = new Player();
- room1 = new Room("a test room.");
- item1 = new Item(3, "testItem", "item1");
- }
- /**
- * test take item method in player class
- */
- public String testTakeItem()
- {
- // put your code here"
- room1.setItems(item1);
- player1.setCurrentRoom(room1);
- player1.takeItem("item1");
- if (player1.checkInventory().equals ("testItem"))
- {
- return "test passes";
- }
- else
- {
- return "test fails";
- }
- }
- public String testDropItem()
- {
- room1.setItems(item1);
- player1.setCurrentRoom(room1);
- player1.takeItem("item1");
- player1.dropItem("item1");
- if (room1.itemCheck("item1") == item1)
- {
- return "test passes";
- }
- else
- {
- return "test fails";
- }
- }
- }
Add Comment
Please, Sign In to add comment