import javax.swing.JButton; import student.GUITestCase; //------------------------------------------------------------------------- /** * An example test case that shows how to test the main() method * for a GUI-based program. Since main() is typically very * simple, it does not require much testing. In fact, if main() * is as simple as in this example, then just one test case is sufficient. * * @author Stephen Edwards * @version 2010.02.21 */ public class PushCounterTest extends GUITestCase { //~ Test methods .......................................................... // ---------------------------------------------------------- /** * Test that {@link PushCounter#main(String[])} shows a * {@link PushCounterPanel}. */ public void testPushCounter() { // You can test complete drivers just by // invoking main() PushCounter.main(null); // You can still retrieve components by name JButton pushMe = getComponent(JButton.class, "button"); assertNotNull(pushMe); // You can even retrieve the panel that is visible PushCounterPanel panel = getComponent(PushCounterPanel.class); assertNotNull(panel); } }