SubRegionTester - tompkins.toString Town ulysses= new Town"Town of Ulysses" 6 10000 Town watkinsglen= new Town"Town of Watkin's

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import junit.framework.TestCase; import java.util.*; /** * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class SubRegionTester extends TestCase { /** * 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.) */ public void testSubRegion() { Town ithaca= new Town("Town of Ithaca", 10, 30000); Town varna= new Town("Townn of Varna", 6, 10000); Vector<Region> t= new Vector<Region>(); t.add(ithaca); t.add(varna); SubRegion tompkins= new SubRegion("Tompkin's County", 123, t); assertEquals(40000, tompkins.getPopulation()); assertEquals("Tompkin's County has area 123 sq miles and has population 40000",
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tompkins.toString()); Town ulysses= new Town("Town of Ulysses", 6, 10000); Town watkinsglen= new Town("Town of Watkin's Glen", 20, 50000); Vector<Region> s= new Vector<Region>(); s.add(ulysses); s.add(watkinsglen); SubRegion seneca= new SubRegion("Seneca County", 234, s); assertEquals(60000, seneca.getPopulation()); assertEquals("Seneca County has area 234 sq miles and has population 60000", seneca.toString()); Vector<Region> r= new Vector<Region>(); r.add(tompkins); r.add(seneca); SubRegion fingerlakes= new SubRegion("Finger Lakes Region", 1234, r); assertEquals(100000, fingerlakes.getPopulation()); assertEquals("Finger Lakes Region has area 1234 sq miles and has population 100000", fingerlakes.toString()); } }...
View Full Document

This document was uploaded on 02/24/2010.

Ask a homework question - tutors are online