{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


RhinoTester_Solutions - import junit.framework.TestCase A...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 import junit.framework.TestCase /** * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class RhinoTester extends TestCase { /** Test constructors and getter methods getName, getGender, getMOB, getYOB, * getMother, getFather, getTag, getNumberOfChildren, and toString */ public void testConstructors() { Rhino r1 = new Rhino("alexander", 6, 1989, 'M') Rhino r3 = new Rhino("debbie", 9, 1823, 'F') Rhino r2 = new Rhino("victoria", 8, 1989, 'F', r1, r3, 18) assertEquals("alexander", r1.getName()) assertEquals(6, r1.getMOB()) assertEquals(1989, r1.getYOB()) assertEquals(null, r1.getMother()) assertEquals(r3, r2.getMother()) assertEquals(null, r1.getFather()) assertEquals(r1, r2.getFather()) assertEquals(-1, r1.getTag()) assertEquals(18, r2.getTag()) assertEquals(1, r1.getNumberOfChildren()) assertEquals(1, r3.getNumberOfChildren()) assertEquals(0, r2.getNumberOfChildren()) assertEquals("M rhino alexander. Born 6/1989. Has 1 child.", r1.toString()) assertEquals("F rhino victoria. Tag 18. Born 8/1989. Has 0 children.", r2.toString()) } /** Test setter methods setName, setGender, setMOB, setYOB, setMother, setFather, and setTag */
Image of page 1

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

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

{[ snackBarMessage ]}