From 2c73289e908dab30954525a186ca63fca731f9df Mon Sep 17 00:00:00 2001 From: Takuya Ono Date: Sun, 6 Nov 2005 07:59:37 +0000 Subject: [PATCH] JUnit: Close, CANCEL and OK button test. --- src/test/org/jent/checksmtp/ToListDialogTest.java | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/test/org/jent/checksmtp/ToListDialogTest.java b/src/test/org/jent/checksmtp/ToListDialogTest.java index 64bb464..899024c 100644 --- a/src/test/org/jent/checksmtp/ToListDialogTest.java +++ b/src/test/org/jent/checksmtp/ToListDialogTest.java @@ -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); } } -- 2.11.0