JUnit: How to test listener class methods using JUnit? [message #251039] |
Mon, 28 January 2008 17:13 |
Eclipse User |
|
|
|
Originally posted by: fayezin.islam.gmail.com
Hello,
I want to test objects returned by a listener class's "xxxchanged" or
"xxxperformed" method.
I want to do this by adding the listener to an object and performing the
appropriate actions that triggers an event in the listener.
Then AFTER a callback has been received, I want to obtain and run some
assertions on the object obtained by the xxxchanged method.
Example: Test ActionListener class
1. Instantiate a JButton
2. Add ActionListener to it
3. Press the button using code
4. Check that actionPerformed method got called
5. Assert fields of ActionEvent object passed to actionPerformed method
I am not sure how to do this using JUnit.
Please advice.
Thanks,
nitrousfiz
|
|
|
Powered by
FUDForum. Page generated in 0.03453 seconds