From: Steve F. <sm...@us...> - 2002-08-03 22:23:01
|
Update of /cvsroot/mockobjects/no-stone-unturned/src/nostone/tests In directory usw-pr-cvs1:/tmp/cvs-serv24636/src/nostone/tests Modified Files: SearcherTest.java Log Message: Index: SearcherTest.java =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/src/nostone/tests/SearcherTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SearcherTest.java 2 Aug 2002 21:57:09 -0000 1.1 +++ SearcherTest.java 3 Aug 2002 22:22:59 -0000 1.2 @@ -3,6 +3,7 @@ import junit.framework.TestCase; import nostone.tests.TestHelper; import nostone.gui.Searcher; +import nostone.gui.Directory; import javax.swing.*; import java.awt.*; @@ -13,7 +14,11 @@ } public void testNoMatchesFound() { - Searcher searcher = new Searcher(); + Searcher searcher = new Searcher(new Directory() {}); + + assertEquals("Should be status", + "", + ((JLabel)findNamedComponent(searcher, "status")).getText().trim()); ((JButton)findNamedComponent(searcher, "search button")).doClick(); @@ -21,6 +26,23 @@ "No entries found", ((JLabel)findNamedComponent(searcher, "status")).getText()); } + + + public void testOneMatchFound() { + Searcher searcher = new Searcher(new Directory() {}); + + // addSearchResult("One Result"); + + ((JButton)findNamedComponent(searcher, "search button")).doClick(); + + assertEquals("Should be result", + "One Result", + ((JTextArea)findNamedComponent(searcher, "results")).getText()); + assertEquals("Should be status", + "", + ((JLabel)findNamedComponent(searcher, "status")).getText()); + } + private Component findNamedComponent(final Container container, final String name) { return new TestHelper().depthFirst(container, new TestHelper.ComponentVisitor() { |