Takuya Ono
takuy****@users*****
2007年 7月 22日 (日) 16:56:30 JST
Index: BetaProject/test/org/jent/checksmtp/ToListUITest.java diff -u /dev/null BetaProject/test/org/jent/checksmtp/ToListUITest.java:1.1 --- /dev/null Sun Jul 22 16:56:30 2007 +++ BetaProject/test/org/jent/checksmtp/ToListUITest.java Sun Jul 22 16:56:30 2007 @@ -0,0 +1,93 @@ +/* + * ToListUITest.java + * JUnit based test + * + * Created on 2007/07/22, 11:41 + */ + +package org.jent.checksmtp; + +import java.util.ArrayList; +import javax.swing.JFrame; +import junit.framework.*; +import junit.swingui.TestRunner; + +/** + * + * @author tkyn + */ +public class ToListUITest extends TestCase implements ResultNotify { + private final ArrayList arrayList = new ArrayList(); + private JFrame toListUI = null; + private boolean result = false; + + public ToListUITest(String testName) { + super(testName); + } + + protected void setUp() throws Exception { + } + + /** + * Test of main method, of class org.jent.checksmtp.ToListUI. + */ + public void testMain() { + System.out.println("main"); + + String[] args = null; + + //ToListUI.main(args); + + // review the generated test code and remove the default call to fail. + //fail("The test case is a prototype."); + + } + + private void pushTestSetup(String msg) { + arrayList.add(msg); + for (int i = 0; i < 100; i++) { + arrayList.add("NO" + i); + } + toListUI = new ToListUI(this, arrayList); + arrayList.clear(); + + try { + synchronized (this) { + wait(30 * 1000); + //Wait 30sec + } + } catch (InterruptedException e) { + fail("Dialg wait interrupted"); + } + } + + private synchronized void notifyResult() { + notify(); + } + + public void sayOK() { + result = true; + notifyResult(); + } + + public void sayNG() { + result = false; + notifyResult(); + } + + public void testPushOK() { + pushTestSetup("Please push OK button."); + assertTrue("Time out or push CANCEL", result); + } + + public void testPushCANCEL() { + pushTestSetup("Please push CANCEL button."); + assertTrue("Time out or push OK", !result); + } + + public void testPushClose() { + pushTestSetup("Please close Window."); + assertTrue("Time out or push OK", !result); + } + +}