OSDN Git Service

JUnit: Close, CANCEL and OK button test.
authortakuya-o <takuya-o>
Sun, 6 Nov 2005 07:59:37 +0000 (07:59 +0000)
committertakuya-o <takuya-o>
Sun, 6 Nov 2005 07:59:37 +0000 (07:59 +0000)
src/test/org/jent/checksmtp/ToListDialogTest.java

index 64bb464..899024c 100644 (file)
@@ -48,21 +48,37 @@ public class ToListDialogTest extends TestCase implements ResultNotify {
     notifyResult();
   }
 
-  public void test1() {
+  private void pushTestSetup(String msg) {
+    arrayList.add(msg);
     for (int i = 0; i < 100; i++) {
       arrayList.add("NO" + i);
     }
     toListDialog = new ToListDialog(this, arrayList);
+    arrayList.clear();
 
     try {
       synchronized (this) {
-        wait();
+        wait(30 * 1000);
+        //Wait 30sec
       }
     } catch (InterruptedException e) {
-      System.err.println("Dialg wait interrupted");
-      e.printStackTrace();
+      fail("Dialg wait interrupted");
     }
+  }
+
+  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);
   }
   
 }