Manually Dispatching a DocumentEvent for testing UI element validation code

Posted by Bassam on Stack Overflow See other posts from Stack Overflow or by Bassam
Published on 2009-08-04T17:04:00Z Indexed on 2010/04/04 14:03 UTC
Read the original article Hit count: 194

Filed under:
|
|
|
|

Hi.

I'm testing a Swing GUI application using the UISpec4J testing framework. I'm testing validation code on a JTextField, but the framework does not support focus-change events, as it runs the application in a headless fashion.

The text field has a DocumentEvent attached to it that activates the validation code. I'm trying to figure out how to dispatch the document event manually to activate the validation code. Trying to dispatch focus or mouse events manually haven't been working for me.

Thanks for any help!

© Stack Overflow or respective owner

Related posts about java

Related posts about testing