RhinoTester_Solutions - import junit.framework.TestCase; /*...

Info iconThis 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())
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.

This homework help was uploaded on 02/20/2009 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell University (Engineering School).

Page1 / 2

RhinoTester_Solutions - import junit.framework.TestCase; /*...

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