RhinoTester (5)_Solutions - import...

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

View Full Document Right Arrow Icon
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 static variable population */ public void testPopulation() { assertEquals(0, Rhino.getPopulation()); 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(3, Rhino.getPopulation()); } /** 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());
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 (5)_Solutions - import...

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