public class IPhListTest { public IPhListTest () {} // Setup: // Phone entries: PhEntry wendy = new PhEntry("wendy", 1234); PhEntry dan = new PhEntry("dan", 8768); PhEntry pat = new PhEntry("pat", 6389); PhEntry matt = new PhEntry("matt", 7999); PhEntry judy = new PhEntry("judy", 1833); PhEntry erna = new PhEntry("erna", 3325); // Phone lists: IPhList imt = new MtPhList(); PhList mt = new PhList(imt); //run the tests and report the results public void runTests(){ // test the method remove // Setup: construct a list with "dan" in it System.out.println("\nObserving the effects of remove and add methods: \n"); IPhList imattlist = new ConsPhList(wendy, new ConsPhList(dan, new ConsPhList(pat,imt))); PhList mattlist = new PhList(imattlist); System.out.println("\nOriginal list with Dan in it: \n" + mattlist); // remove "dan" from the list mattlist.remove("dan"); // observe the effect: System.out.println("\nList with Dan removed: \n" + mattlist); // remove "pat" from the list mattlist.remove("pat"); System.out.println("\nList with Pat (and Dan) removed: \n" + mattlist); // add "pat" back to the list mattlist.add(pat); System.out.println("\nList with Pat (and Dan) removed " + "and Pat added back in: \n" + mattlist); // test the method remove - again // Setup: construct a list with "dan" in it System.out.println("\nObserving the effects of remove and add methods: \n"); IPhList idanlist = new ConsPhList(matt, new ConsPhList(judy, new ConsPhList(erna,imt))); PhList danlist = new PhList(idanlist); System.out.println("\nOriginal list with Judy in it: \n" + danlist); // remove "judy" from the list danlist.remove("judy"); // observe the effect: System.out.println("\nList with Judy removed: \n" + danlist); // remove "erna" from the list danlist.remove("erna"); System.out.println("\nList with Erna (and Judy) removed: \n" + danlist); // remove "matt" from the list danlist.remove("matt"); System.out.println("\nList with Matt (and Erna and Judy) removed: \n" + danlist); } public static void main(String[] argv){ IPhListTest phlt = new IPhListTest(); phlt.runTests(); } }