001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.jellytools;
042:
043: import junit.framework.Test;
044: import junit.textui.TestRunner;
045: import org.netbeans.junit.NbTestSuite;
046:
047: /**
048: * Test of SearchResultsOperator.
049: * @author Jiri.Skrivanek@sun.com
050: */
051: public class SearchResultsOperatorTest extends JellyTestCase {
052:
053: /** Use for internal test execution inside IDE
054: * @param args command line arguments
055: */
056: public static void main(java.lang.String[] args) {
057: TestRunner.run(suite());
058: }
059:
060: /** Method used for explicit testsuite definition
061: * @return created suite
062: */
063: public static Test suite() {
064: NbTestSuite suite = new NbTestSuite();
065: suite
066: .addTest(new SearchResultsOperatorTest(
067: "testBtStopSearch"));
068: suite
069: .addTest(new SearchResultsOperatorTest(
070: "testBtShowDetails"));
071: suite.addTest(new SearchResultsOperatorTest(
072: "testBtModifySearch"));
073: suite.addTest(new SearchResultsOperatorTest("testTreeResult"));
074: suite
075: .addTest(new SearchResultsOperatorTest(
076: "testSelectResult"));
077: suite.addTest(new SearchResultsOperatorTest("testOpenResult"));
078: // suite.addTest(new SearchResultsOperatorTest("testStopSearch"));
079: suite
080: .addTest(new SearchResultsOperatorTest(
081: "testModifySearch"));
082: suite.addTest(new SearchResultsOperatorTest("testShowDetails"));
083: suite.addTest(new SearchResultsOperatorTest(
084: "testWaitEndOfSearch"));
085: suite.addTest(new SearchResultsOperatorTest("testVerify"));
086: return suite;
087: }
088:
089: /** Creates new SearchResultsOperatorTest */
090: public SearchResultsOperatorTest(String testName) {
091: super (testName);
092: }
093:
094: private static SearchResultsOperator searchResultsOper = null;
095:
096: /** Open find dialog on sample project and find sample substring. */
097: public void setUp() {
098: System.out.println("### " + getName() + " ###");
099: if (searchResultsOper == null) {
100: FindInFilesOperator fifo = FindInFilesOperator
101: .invoke(new ProjectsTabOperator()
102: .getProjectRootNode("SampleProject"));
103: fifo.txtText().setText("sample");
104: searchResultsOper = fifo.find();
105: }
106: }
107:
108: /** Test btStopSearch method */
109: public void testBtStopSearch() {
110: searchResultsOper.btStopSearch();
111: }
112:
113: /** Test btShowDetails method */
114: public void testBtShowDetails() {
115: searchResultsOper.btShowDetails();
116: }
117:
118: /** Test btModifySearch method */
119: public void testBtModifySearch() {
120: searchResultsOper.btModifySearch();
121: }
122:
123: /** Test treeResult method */
124: public void testTreeResult() {
125: searchResultsOper.treeResult();
126: }
127:
128: /** Test selectResult method */
129: public void testSelectResult() {
130: searchResultsOper.selectResult("SampleClass1.java"); //NOI18N
131: }
132:
133: /** Test openResult method */
134: public void testOpenResult() {
135: searchResultsOper.openResult("SampleClass1.java|sample"); //NOI18N
136: new EditorOperator("SampleClass1").close(); //NOI18N
137: }
138:
139: /** Test stopSearch method */
140: public void testStopSearch() {
141: // need to find a test case to test it
142: }
143:
144: /** Test showDetails method */
145: public void testShowDetails() {
146: searchResultsOper.makeComponentVisible();
147: searchResultsOper.showDetails().close();
148: }
149:
150: /** Test modifySearch method*/
151: public void testModifySearch() {
152: searchResultsOper.modifySearch().close();
153: }
154:
155: /** Test waitEndOfSearch method */
156: public void testWaitEndOfSearch() {
157: // searching done in setup should be finished
158: searchResultsOper.waitEndOfSearch();
159: }
160:
161: /** Test verify method */
162: public void testVerify() {
163: searchResultsOper.verify();
164: searchResultsOper.close();
165: }
166: }
|