|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| JWindowFinderT.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
package junit.extensions.jfcunit.finder;
|
|
| 2 |
|
|
| 3 |
import junit.extensions.jfcunit.AbstractTestCase;
|
|
| 4 |
|
|
| 5 |
import javax.swing.JFrame;
|
|
| 6 |
import javax.swing.JWindow;
|
|
| 7 |
|
|
| 8 |
/**
|
|
| 9 |
* A TestCase to test the methods in the JWindowFinder class.
|
|
| 10 |
*
|
|
| 11 |
* @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
|
|
| 12 |
*/
|
|
| 13 |
public class JWindowFinderT extends AbstractTestCase { |
|
| 14 |
/**
|
|
| 15 |
* Constructor.
|
|
| 16 |
*
|
|
| 17 |
* @param name Name of the test case.
|
|
| 18 |
*/
|
|
| 19 | 2 |
public JWindowFinderT(final String name) {
|
| 20 | 2 |
super(name);
|
| 21 |
} |
|
| 22 |
|
|
| 23 |
/**
|
|
| 24 |
* Tests the 'testComponent' method for: invalid component.
|
|
| 25 |
*
|
|
| 26 |
* @exception Exception An instance of java.lang.Exception can be thrown
|
|
| 27 |
*/
|
|
| 28 | 1 |
public void testTestComponentInvalidComponent() throws Exception { |
| 29 | 1 |
JWindowFinder finder = new JWindowFinder();
|
| 30 | 1 |
JFrame frame = createJFrame(getName()); |
| 31 | 1 |
packAndShow(frame); |
| 32 | 1 |
assertFalse("Finder is not working", finder.testComponent(frame));
|
| 33 |
} |
|
| 34 |
|
|
| 35 |
/**
|
|
| 36 |
* Tests the 'testComponent' method for: valid component.
|
|
| 37 |
*
|
|
| 38 |
* @exception Exception An instance of java.lang.Exception can be thrown
|
|
| 39 |
*/
|
|
| 40 | 1 |
public void testTestComponentValidComponent() throws Exception { |
| 41 | 1 |
JWindowFinder finder = new JWindowFinder();
|
| 42 | 1 |
JWindow win = new JWindow();
|
| 43 | 1 |
win.setSize(200, 200); |
| 44 | 1 |
win.pack(); |
| 45 | 1 |
win.setVisible(true);
|
| 46 | 1 |
assertTrue("Finder is not working", finder.testComponent(win));
|
| 47 |
} |
|
| 48 |
} |
|
| 49 |
|
|
||||||||||