KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > extbrowser > NbDdeBrowserImplTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  *
19  * NbDdeBrowserImplTest.java
20  * NetBeans JUnit based test
21  *
22  * Created on November 2, 2001, 10:42 AM
23  */

24
25 package org.netbeans.modules.extbrowser;
26
27 import junit.framework.*;
28 import org.netbeans.junit.*;
29 import java.awt.*;
30 import java.awt.event.*;
31 import java.beans.*;
32 import java.net.*;
33 import javax.swing.*;
34 import java.util.ResourceBundle JavaDoc;
35 import java.util.StringTokenizer JavaDoc;
36 import java.util.Timer JavaDoc;
37 import java.util.TimerTask JavaDoc;
38 import java.util.Vector JavaDoc;
39 import org.openide.NotifyDescriptor;
40 import org.openide.ErrorManager;
41 import org.openide.awt.HtmlBrowser;
42 import org.openide.execution.NbProcessDescriptor;
43 import org.openide.options.SystemOption;
44 import org.openide.util.SharedClassObject;
45 import org.openide.util.Utilities;
46 import org.openide.util.NbBundle;
47          
48 /**
49  *
50  * @author rk109395
51  */

52 public class NbDdeBrowserImplTest extends NbTestCase {
53
54     public NbDdeBrowserImplTest (java.lang.String JavaDoc testName) {
55         super(testName);
56     }
57         
58     public static void main(java.lang.String JavaDoc[] args) {
59         junit.textui.TestRunner.run(suite());
60     }
61     
62     private NbDdeBrowserImpl getDDEBrowserImpl() {
63         return (NbDdeBrowserImpl)((DelegatingWebBrowserImpl)testObject).getImplementation();
64     }
65     
66     /** Test of getBrowserPath method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
67     public void testGetBrowserPath () throws NbBrowserException {
68         if (!org.openide.util.Utilities.isWindows ())
69             return;
70         getDDEBrowserImpl().getBrowserPath ("IEXPLORE");
71     }
72     
73     /** Test of getDefaultOpenCommand method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
74     public void testGetDefaultOpenCommand () throws NbBrowserException {
75         if (!org.openide.util.Utilities.isWindows ())
76             return;
77         getDDEBrowserImpl().getDefaultOpenCommand ();
78     }
79     
80     /** Test of backward method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
81     public void testBackward () {
82         if (!org.openide.util.Utilities.isWindows ())
83             return;
84         
85         testObject.backward ();
86     }
87     
88     /** Test of forward method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
89     public void testForward () {
90         if (!org.openide.util.Utilities.isWindows ())
91             return;
92         testObject.forward ();
93     }
94     
95     /** Test of isBackward method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
96     public void testIsBackward () {
97         if (!org.openide.util.Utilities.isWindows ())
98             return;
99         testObject.isBackward ();
100     }
101     
102     /** Test of isForward method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
103     public void testIsForward () {
104         if (!org.openide.util.Utilities.isWindows ())
105             return;
106         testObject.isForward ();
107     }
108     
109     /** Test of isHistory method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
110     public void testIsHistory () {
111         if (!org.openide.util.Utilities.isWindows ())
112             return;
113         if (testObject.isHistory ())
114             fail ("NbDdeBrowserImpl.isHistory retunred true. It should return false.");
115     }
116     
117     /** Test of reloadDocument method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
118     public void testReloadDocument () {
119         if (!org.openide.util.Utilities.isWindows ())
120             return;
121         testObject.reloadDocument ();
122     }
123     
124     /** Test of setURL method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
125     public void testSetURL () throws java.net.MalformedURLException JavaDoc {
126         if (!org.openide.util.Utilities.isWindows ())
127             return;
128         testObject.setURL (new java.net.URL JavaDoc ("http://www.netbeans.org/"));
129     }
130     
131     /** Test of showHistory method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
132     public void testShowHistory () {
133         if (!org.openide.util.Utilities.isWindows ())
134             return;
135         testObject.showHistory ();
136     }
137     
138     /** Test of stopLoading method, of class org.netbeans.modules.extbrowser.NbDdeBrowserImpl. */
139     public void testStopLoading () {
140         if (!org.openide.util.Utilities.isWindows ())
141             return;
142         testObject.stopLoading ();
143     }
144     
145     public static Test suite () {
146         TestSuite suite = new NbTestSuite (NbDdeBrowserImplTest.class);
147         
148         return suite;
149     }
150     
151     // Add test methods here, they have to start with 'test' name.
152
// for example:
153
// public void testHello() {}
154
protected ExtBrowserImpl testObject;
155     
156     protected void setUp () {
157         if (org.openide.util.Utilities.isWindows ())
158             testObject = (ExtBrowserImpl)new ExtWebBrowser ().createHtmlBrowserImpl ();
159     }
160
161 }
162
Popular Tags