01: package jaxx.junit;
02:
03: import java.awt.*;
04: import java.io.*;
05: import javax.swing.*;
06: import javax.swing.event.*;
07: import org.w3c.dom.*;
08: import junit.framework.TestCase;
09:
10: import jaxx.compiler.*;
11: import jaxx.reflect.*;
12: import jaxx.tags.*;
13:
14: public class UtilTest extends TestCase {
15: private int count;
16:
17: public void testGetEventListener() {
18: count = 0;
19: DocumentListener listener = (DocumentListener) jaxx.runtime.Util
20: .getEventListener(
21: javax.swing.event.DocumentListener.class, this ,
22: "incCount");
23: listener.insertUpdate(null);
24: assertEquals(count, 1);
25: DocumentListener listener2 = (DocumentListener) jaxx.runtime.Util
26: .getEventListener(
27: javax.swing.event.DocumentListener.class, this ,
28: "incCount");
29: listener2.removeUpdate(null);
30: assertEquals(count, 2);
31: //assertTrue("Received two different event listeners despite using identical parameters", listener == listener2);
32: }
33:
34: public void incCount(DocumentEvent e) {
35: count++;
36: }
37: }
|