OSDN Git Service

JUnit: Add JUnit test case.
[mdc/BetaProject.git] / src / test / org / jent / checksmtp / ToListDialogTest.java
1 package test.org.jent.checksmtp;
2
3 import java.util.ArrayList;
4
5 import javax.swing.JDialog;
6
7 import junit.framework.TestCase;
8
9 import junit.swingui.TestRunner;
10
11 import org.jent.checksmtp.ResultNotify;
12 import org.jent.checksmtp.ToListDialog;
13
14 public class ToListDialogTest extends TestCase implements ResultNotify {
15
16   private final ArrayList arrayList = new ArrayList();
17   private JDialog toListDialog = null;
18   private boolean result = false;
19
20   public ToListDialogTest(String sTestName) {
21     super(sTestName);
22   }
23
24   public static void main(String args[]) {
25     String args2[] = {"-noloading", "test.org.jent.checksmtp.ToListDialogTest"};
26     TestRunner.main(args2);
27   }
28
29   protected void setUp() throws Exception {
30     super.setUp();
31
32   }
33
34   protected void tearDown() throws Exception {
35     super.tearDown();
36     toListDialog.dispose();
37   }
38   
39   private synchronized void notifyResult() {
40     notify();
41   }
42   public void sayOK() {
43     result = true;
44     notifyResult();
45   }
46   public void sayNG() {
47     result = false;
48     notifyResult();
49   }
50
51   public void test1() {
52     for (int i = 0; i < 100; i++) {
53       arrayList.add("NO" + i);
54     }
55     toListDialog = new ToListDialog(this, arrayList);
56
57     try {
58       synchronized (this) {
59         wait();
60       }
61     } catch (InterruptedException e) {
62       System.err.println("Dialg wait interrupted");
63       e.printStackTrace();
64     }
65
66   }
67   
68 }