ExplorerTest

ExplorerTest - import junit.framework.TestCase; /* * A...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import junit.framework.TestCase; i /** * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class ExplorerTest extends TestCase { private Room r; private Room r2; private Explorer columbus; private Denizen gollum; public void setUp(){ r = new Room ("Ooze"); r2 = new Room ("Ow"); columbus = new Explorer("Chris", r, 100, 50); gollum = new Denizen("Blob", r, 75, 25); } /** * A test method. * (Replace "X" with a name describing the test. You may write as * many "testSomething" methods in this class as you wish, and each * one will be called when running JUnit over this class.) */ // Test name query. public void testName() { assertTrue(columbus.name().equals("Chris")); } // Test location query. public void testLocation() { assertTrue (columbus.location().equals (r)); } // Test strength query. public void testStrength() { assertTrue (columbus.strength() == (100)); } // Test tolerance query.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

ExplorerTest - import junit.framework.TestCase; /* * A...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online