import java.util.*; import tester.*; import colors.*; /** *

The client class for the {@link Balloon Balloon} class * and a class that represents three ballons ordered as given by the * Comparator.

*

Tests for the methods for these classes.

* * @since 7 March 2009 * @author Viera K. Proulx */ public class Examples{ public Examples(){} /** a big red {@link Balloon Balloon} */ Balloon b1 = new Balloon(100, 200, 25, new Red()); /** a small blue {@link Balloon Balloon} */ Balloon b2 = new Balloon(200, 100, 20, new Blue()); /** a big green {@link Balloon Balloon} */ Balloon b3 = new Balloon(200, 150, 30, new Green()); /** a small red {@link Balloon Balloon} */ Balloon b4 = new Balloon(200, 120, 22, new Red()); /** * A method to construct an ArrayList * with four {@link Balloon Balloon}s * * @return an ArrayList with four * {@link Balloon Balloon}s */ public ArrayList makeArrBlist(){ ArrayList arrlist = new ArrayList(); arrlist.add(this.b1); arrlist.add(this.b2); arrlist.add(this.b3); arrlist.add(this.b4); return arrlist; } /** {@link Balloon Balloon} class tests: equality */ public void testEquality(Tester t){ t.checkExpect(this.b2, new Balloon(200, 100, 20, new Blue()), "the same balloons OK"); t.checkExpect(this.b2, this.b2, "the same balloons OK"); } /** {@link Balloon Balloon} class tests: * the distanceFromTop method */ public void testDistanceFromTop(Tester t){ t.checkExpect(this.b1.distanceFromTop(), 200 - 25, "distanceFromTop 1"); t.checkExpect(this.b2.distanceFromTop(), 80, "distanceFromTop 2"); } }