



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Pugh; Class: PROG LANG TECH & PDGMS; Subject: Computer Science; University: University of Maryland; Term: Spring 2003;
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




public class ListTest extends TestCase { public void testAdd() { LinkedList l = new LinkedList(); Object o = new Object(); l.add(o); assertTrue(l.contains(o)); } public void runTest() { testAdd(); } public static void main(String args[]) { TestResult result = (new ListTest().run()); if (!result.wasSuccessful()) { System.out.println(“Doh!”); } } Create objects Perform test/ check result
public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new ListTest(“testAdd”)); suite.addTest(new ListTest(“testPushPop”)); return suite; }
public static Test suite() { return new TestSuite(ListTest.class); }