JAVA HW - import junit.framework.TestCase; /* * An instance...

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

View Full Document Right Arrow Icon
import junit.framework.TestCase; /** * An instance hosues testcases for class Person. */ public class PersonTester extends TestCase { /** Test method for Constructor 1. *Tests indivduals information with getter methods*/ public void testConstructor1() { Person a= new Person("Seth",1990,true); assertEquals ("Seth",a.getName()); assertEquals (1990,a.getYear()); assertEquals (null,a.getStatus()); assertEquals ("true", a.isMale()); assertEquals (null, a.getFBF()); assertEquals (null, a.getMBF()); assertEquals (null, a.getNumBFedBy()); } /**Test method for the Setter Methods * Setting The person's status, their Female Best Friend * And their Male Best Friend */ public void testSetter() { Person a= new Person ("Bob", 1990, true); Person b= new Person ("Jackie", 1991, false); Person c= new Person ("Joe", 1992, true); a.setStatusMessage ("working on CS"); assertEquals ("working on CS", a.getStatus()); a.addFBF(b); assertEquals (b, a.getFBF()); a.addMBF (c); assertEquals (c, a.getMBF()); }
Background image of page 1

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

View Full DocumentRight Arrow Icon
/**Test method for Constructor 2 * A new person with display name n, birth year y, gender male, * status message s, best female friend ff, and best male friend mf*/
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/07/2011 for the course CS 9339 at Cornell University (Engineering School).

Page1 / 5

JAVA HW - import junit.framework.TestCase; /* * An instance...

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

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