OSDN Git Service

JUnit: Add JUnit test case.
authortakuya-o <takuya-o>
Sat, 5 Nov 2005 21:15:16 +0000 (21:15 +0000)
committertakuya-o <takuya-o>
Sat, 5 Nov 2005 21:15:16 +0000 (21:15 +0000)
src/mdc.deploy
src/test/org/jent/checksmtp/ToListDialogTest.java [new file with mode: 0644]

index 7adb3ee..a63dae9 100644 (file)
@@ -16,6 +16,8 @@
             <displayName>Project Output</displayName>
             <filters>
                <rules>
+                  <Item type="1" pattern="CodeStyleProfile.xml"/>
+                  <Item type="1" pattern="test/"/>
                   <Item type="1" pattern="**/CVS/"/>
                   <Item type="1" pattern="**.cdi"/>
                   <Item type="1" pattern="**.contrib"/>
diff --git a/src/test/org/jent/checksmtp/ToListDialogTest.java b/src/test/org/jent/checksmtp/ToListDialogTest.java
new file mode 100644 (file)
index 0000000..64bb464
--- /dev/null
@@ -0,0 +1,68 @@
+package test.org.jent.checksmtp;
+
+import java.util.ArrayList;
+
+import javax.swing.JDialog;
+
+import junit.framework.TestCase;
+
+import junit.swingui.TestRunner;
+
+import org.jent.checksmtp.ResultNotify;
+import org.jent.checksmtp.ToListDialog;
+
+public class ToListDialogTest extends TestCase implements ResultNotify {
+
+  private final ArrayList arrayList = new ArrayList();
+  private JDialog toListDialog = null;
+  private boolean result = false;
+
+  public ToListDialogTest(String sTestName) {
+    super(sTestName);
+  }
+
+  public static void main(String args[]) {
+    String args2[] = {"-noloading", "test.org.jent.checksmtp.ToListDialogTest"};
+    TestRunner.main(args2);
+  }
+
+  protected void setUp() throws Exception {
+    super.setUp();
+
+  }
+
+  protected void tearDown() throws Exception {
+    super.tearDown();
+    toListDialog.dispose();
+  }
+  
+  private synchronized void notifyResult() {
+    notify();
+  }
+  public void sayOK() {
+    result = true;
+    notifyResult();
+  }
+  public void sayNG() {
+    result = false;
+    notifyResult();
+  }
+
+  public void test1() {
+    for (int i = 0; i < 100; i++) {
+      arrayList.add("NO" + i);
+    }
+    toListDialog = new ToListDialog(this, arrayList);
+
+    try {
+      synchronized (this) {
+        wait();
+      }
+    } catch (InterruptedException e) {
+      System.err.println("Dialg wait interrupted");
+      e.printStackTrace();
+    }
+
+  }
+  
+}