Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » JUnit: How to test listener class methods using JUnit?
JUnit: How to test listener class methods using JUnit? [message #251039] Mon, 28 January 2008 17:13
Eclipse UserFriend
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
Previous Topic:ExternalJavaProject (support for java outside a java project) and Jar update.
Next Topic:How to create project but not show in project navigator view
Goto Forum:
  


Current Time: Sun Jul 06 11:30:40 EDT 2025

Powered by FUDForum. Page generated in 0.03453 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top