[304137] Update for JUnit 4 Test Framework. Bumped minor version since OrderedTestSuite is being removed and tests are run unordered.
diff --git a/tests/org.eclipse.jst.server.tomcat.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.server.tomcat.ui.tests/META-INF/MANIFEST.MF index 7ef64b0..e73fd27 100644 --- a/tests/org.eclipse.jst.server.tomcat.ui.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.jst.server.tomcat.ui.tests/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.eclipse.jst.server.tomcat.ui.tests Bundle-SymbolicName: org.eclipse.jst.server.tomcat.ui.tests -Bundle-Version: 1.0.300.qualifier +Bundle-Version: 1.1.00.qualifier Bundle-ClassPath: tests.jar Bundle-Activator: org.eclipse.jst.server.tomcat.ui.tests.TestsPlugin Bundle-Vendor: Eclipse.org Export-Package: org.eclipse.jst.server.tomcat.ui.tests Require-Bundle: org.eclipse.core.runtime, - org.junit;bundle-version="[3.8.0,4.0.0)", + org.junit;bundle-version="3.8.0", org.eclipse.ui, org.eclipse.wst.server.core, org.eclipse.wst.server.ui,
diff --git a/tests/org.eclipse.jst.server.tomcat.ui.tests/src/org/eclipse/jst/server/tomcat/ui/tests/OrderedTestSuite.java b/tests/org.eclipse.jst.server.tomcat.ui.tests/src/org/eclipse/jst/server/tomcat/ui/tests/OrderedTestSuite.java deleted file mode 100644 index cabf5ad..0000000 --- a/tests/org.eclipse.jst.server.tomcat.ui.tests/src/org/eclipse/jst/server/tomcat/ui/tests/OrderedTestSuite.java +++ /dev/null
@@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.server.tomcat.ui.tests; - -import java.util.Enumeration; -import java.util.Vector; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -class OrderedTestSuite extends TestSuite{ - public OrderedTestSuite(Class theClass) { - super(theClass); - } - - public Enumeration tests() { - Enumeration enum2 = super.tests(); - - Vector list = new Vector(); - while (enum2.hasMoreElements()) { - list.add(enum2.nextElement()); - } - - int size = list.size(); - for (int i = 0; i < size - 1; i++) { - for (int j = i + 1; j < size; j++) { - TestCase t1 = (TestCase) list.get(i); - TestCase t2 = (TestCase) list.get(j); - if (t1.getName().compareTo(t2.getName()) > 0) { - Object obj = list.get(i); - list.set(i, list.get(j)); - list.set(j, obj); - } - } - } - - return list.elements(); - } -} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.server.ui.tests/META-INF/MANIFEST.MF index bc1239b..bee9129 100644 --- a/tests/org.eclipse.wst.server.ui.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.wst.server.ui.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.eclipse.wst.server.ui.tests Bundle-SymbolicName: org.eclipse.wst.server.ui.tests -Bundle-Version: 1.0.300.qualifier +Bundle-Version: 1.1.000.qualifier Bundle-ClassPath: tests.jar Bundle-Activator: org.eclipse.wst.server.ui.tests.TestsPlugin Bundle-Vendor: Eclipse.org @@ -14,7 +14,7 @@ org.eclipse.wst.server.ui.tests.wizard Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources, - org.junit;bundle-version="[3.8.0,4.0.0)", + org.junit;bundle-version="3.8.0", org.eclipse.ui, org.eclipse.ui.forms, org.eclipse.debug.core,
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/AllTests.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/AllTests.java index 3de97d8..2324128 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/AllTests.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/AllTests.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. + * Copyright (c) 2004, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,25 +26,24 @@ suite.addTestSuite(ServerUIPreferencesTestCase.class); suite.addTestSuite(ServerUICoreTestCase.class); - suite.addTest(new OrderedTestSuite(ServerLaunchConfigurationTabTestCase.class)); + suite.addTestSuite(ServerLaunchConfigurationTabTestCase.class); - suite.addTest(new OrderedTestSuite(IServerEditorPartInputTestCase.class)); - suite.addTest(new OrderedTestSuite(ServerEditorSectionTestCase.class)); - suite.addTest(new OrderedTestSuite(ServerEditorPartTestCase.class)); + suite.addTestSuite(IServerEditorPartInputTestCase.class); + suite.addTestSuite(ServerEditorSectionTestCase.class); + suite.addTestSuite(ServerEditorPartTestCase.class); suite.addTestSuite(DialogsTestCase.class); suite.addTestSuite(PreferencesTestCase.class); suite.addTestSuite(ViewTestCase.class); suite.addTestSuite(WizardTestCase.class); - suite.addTest(new OrderedTestSuite(IOrderedTestCase.class)); - suite.addTest(new OrderedTestSuite(ServerEditorActionFactoryDelegateTestCase.class)); + suite.addTestSuite(ServerEditorActionFactoryDelegateTestCase.class); suite.addTestSuite(IWizardHandleTestCase.class); - suite.addTest(new OrderedTestSuite(TaskWizardTestCase.class)); - suite.addTest(new OrderedTestSuite(WizardFragmentTestCase.class)); + suite.addTestSuite(TaskWizardTestCase.class); + suite.addTestSuite(WizardFragmentTestCase.class); - suite.addTest(new OrderedTestSuite(ServerTooltipTestCase.class)); + suite.addTestSuite(ServerTooltipTestCase.class); //$JUnit-END$ return suite; }
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/OrderedTestSuite.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/OrderedTestSuite.java deleted file mode 100644 index 6b3c143..0000000 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/OrderedTestSuite.java +++ /dev/null
@@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.ui.tests; - -import java.util.Enumeration; -import java.util.Vector; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class OrderedTestSuite extends TestSuite { - public OrderedTestSuite(Class theClass) { - super(theClass); - } - - @SuppressWarnings("unchecked") - public Enumeration tests() { - Enumeration<TestCase> enum2 = super.tests(); - - Vector<TestCase> list = new Vector<TestCase>(); - while (enum2.hasMoreElements()) { - list.add(enum2.nextElement()); - } - - int size = list.size(); - for (int i = 0; i < size - 1; i++) { - for (int j = i + 1; j < size; j++) { - TestCase t1 = list.get(i); - TestCase t2 = list.get(j); - if (t1.getName().compareTo(t2.getName()) > 0) { - TestCase obj = list.get(i); - list.set(i, list.get(j)); - list.set(j, obj); - } - } - } - - return list.elements(); - } -}
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerLaunchConfigurationTabTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerLaunchConfigurationTabTestCase.java index aea7987..ae08e98 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerLaunchConfigurationTabTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerLaunchConfigurationTabTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. + * Copyright (c) 2004, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,68 +14,76 @@ import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab; +/* Note: These tests may be executed in any order. Because null is used as most + * arguments, the order doesn't currently matter. If non-null arguments are used, + * it may be necessary to rewrite the tests to make them truly order independent. + */ + public class ServerLaunchConfigurationTabTestCase extends TestCase { protected static ServerLaunchConfigurationTab tab; - public void test00CreateTab() { - tab = new ServerLaunchConfigurationTab(); + protected ServerLaunchConfigurationTab getServerLaunchConfigurationTab() { + if (tab == null) { + tab = new ServerLaunchConfigurationTab(new String[]{"test"}); + } + return tab; + } + + public void testCreateTabAllTypes() { + new ServerLaunchConfigurationTab(); } - public void test01CreateTab() { - tab = new ServerLaunchConfigurationTab(new String[]{"test"}); - } - - public void test02CreateControl() { + public void testCreateControl() { try { - tab.createControl(null); + getServerLaunchConfigurationTab().createControl(null); } catch (Exception e) { // ignore } } - public void test03SetDefaults() { + public void testSetDefaults() { try { - tab.setDefaults(null); + getServerLaunchConfigurationTab().setDefaults(null); } catch (Exception e) { // ignore } } - public void test04InitializeFrom() { + public void testInitializeFrom() { try { - tab.initializeFrom(null); + getServerLaunchConfigurationTab().initializeFrom(null); } catch (Exception e) { // ignore } } - public void test05PerformApply() { + public void testPerformApply() { try { - tab.performApply(null); + getServerLaunchConfigurationTab().performApply(null); } catch (Exception e) { // ignore } } - public void test06IsValid() { + public void testIsValid() { try { - tab.isValid(null); + getServerLaunchConfigurationTab().isValid(null); } catch (Exception e) { // ignore } } - public void test07GetImage() { - tab.getImage(); + public void testGetImage() { + getServerLaunchConfigurationTab().getImage(); } - public void test08GetName() { - tab.getName(); + public void testGetName() { + getServerLaunchConfigurationTab().getName(); } public void test09TestProtectedMethods() {
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerTooltipTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerTooltipTestCase.java index d7c33f4..4b6cf08 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerTooltipTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/ServerTooltipTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,6 +29,17 @@ protected static ServerToolTip tooltip; protected static IServerToolTip exTooltip; + protected ServerToolTip getServerToolTip() { + if (tooltip == null) { + Tree tree = new Tree(new Shell(),SWT.SINGLE); + TreeItem tItem = new TreeItem(tree,SWT.NONE); + tItem.setText("Item 1"); + tree.setTopItem(tItem); + tooltip = new ServerToolTip(tree); + } + return tooltip; + } + public void test00CreateExtensionToolTip(){ exTooltip = new IServerToolTip(){ public void createContent(Composite parent, IServer server) { @@ -38,15 +49,10 @@ } public void test01ActivateToolTip(){ - Tree tree = new Tree(new Shell(),SWT.SINGLE); - TreeItem tItem = new TreeItem(tree,SWT.NONE); - tItem.setText("Item 1"); - tree.setTopItem(tItem); - tooltip = new ServerToolTip(tree); - tooltip.activate(); + getServerToolTip().activate(); } public void test02DeactivateToolTip(){ - tooltip.deactivate(); + getServerToolTip().deactivate(); } } \ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/IOrderedTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/IOrderedTestCase.java deleted file mode 100644 index 32409c2..0000000 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/IOrderedTestCase.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.server.ui.tests.editor; - -import junit.framework.TestCase; - -import org.eclipse.wst.server.ui.internal.editor.IOrdered; -import org.eclipse.wst.server.ui.tests.impl.TestOrdered; - -public class IOrderedTestCase extends TestCase { - protected static IOrdered ordered; - - public void test00Create() { - ordered = new TestOrdered(); - } - - public void test01GetOrder() { - ordered.getOrder(); - } -} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/IServerEditorPartInputTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/IServerEditorPartInputTestCase.java index 49f78c2..11cd219 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/IServerEditorPartInputTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/IServerEditorPartInputTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,39 +18,42 @@ public class IServerEditorPartInputTestCase extends TestCase { protected static IServerEditorPartInput input; - public void test00Create() { - input = new TestServerEditorPartInput(); + protected IServerEditorPartInput getServerEditorPartInput() { + if (input == null) { + input = new TestServerEditorPartInput(); + } + return input; } - public void test01GetServer() { - input.getServer(); + public void testGetServer() { + getServerEditorPartInput().getServer(); } - public void test02IsServerReadOnly() { - input.isServerReadOnly(); + public void testIsServerReadOnly() { + getServerEditorPartInput().isServerReadOnly(); } - public void test04Exists() { - input.exists(); + public void testExists() { + getServerEditorPartInput().exists(); } - public void test05GetImageDescriptor() { - input.getImageDescriptor(); + public void testGetImageDescriptor() { + getServerEditorPartInput().getImageDescriptor(); } - public void test06GetName() { - input.getName(); + public void testGetName() { + getServerEditorPartInput().getName(); } - public void test07GetPersistable() { - input.getPersistable(); + public void testGetPersistable() { + getServerEditorPartInput().getPersistable(); } - public void test08GetToolTipText() { - input.getToolTipText(); + public void testGetToolTipText() { + getServerEditorPartInput().getToolTipText(); } - public void test09GetAdapter() { - input.getAdapter(null); + public void testGetAdapter() { + getServerEditorPartInput().getAdapter(null); } } \ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorActionFactoryDelegateTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorActionFactoryDelegateTestCase.java index 0bd8ff6..d9610ad 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorActionFactoryDelegateTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorActionFactoryDelegateTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,18 +15,26 @@ import org.eclipse.wst.server.ui.internal.provisional.ServerEditorActionFactoryDelegate; import org.eclipse.wst.server.ui.tests.impl.TestServerEditorActionFactoryDelegate; +/* Note: These tests may be executed in any order. Because null is used as most + * arguments, the order doesn't currently matter. If non-null arguments are used, + * it may be necessary to rewrite the tests to make them truly order independent. + */ + public class ServerEditorActionFactoryDelegateTestCase extends TestCase { protected static ServerEditorActionFactoryDelegate delegate; - public void test00CreateDelegate() throws Exception { - delegate = new TestServerEditorActionFactoryDelegate(); + protected ServerEditorActionFactoryDelegate getDelegate() { + if (delegate == null) { + delegate = new TestServerEditorActionFactoryDelegate(); + } + return delegate; + } + + public void testShouldDisplay() throws Exception { + getDelegate().shouldDisplay(null); } - public void test01ShouldDisplay() throws Exception { - delegate.shouldDisplay(null); - } - - public void test02CreateAction() throws Exception { - delegate.createAction(null, null); + public void testCreateAction() throws Exception { + getDelegate().createAction(null, null); } } \ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorPartTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorPartTestCase.java index 92ebec1..689cae5 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorPartTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorPartTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,78 +15,107 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.wst.server.ui.editor.ServerEditorPart; +/* Note: These tests may be executed in any order. Because null is used as most + * arguments, the order doesn't currently matter. If non-null arguments are used, + * it may be necessary to rewrite the tests to make them truly order independent. + */ + public class ServerEditorPartTestCase extends TestCase { protected static ServerEditorPart editor; + protected static ServerEditorPart initEditor; - public void test00CreateEditor() { - editor = new ServerEditorPart() { - public void createPartControl(Composite parent) { - // do nothing + protected ServerEditorPart getServerEditorPart() { + if (editor == null) { + editor = new ServerEditorPart() { + public void createPartControl(Composite parent) { + // do nothing + } + + public void setFocus() { + // do nothing + } + }; + } + return editor; + } + + protected ServerEditorPart getInitializedServerEditorPart() { + if (initEditor == null) { + initEditor = new ServerEditorPart() { + public void createPartControl(Composite parent) { + // do nothing + } + + public void setFocus() { + // do nothing + } + }; + try { + initEditor.init(null, null); } - - public void setFocus() { - // do nothing + catch (Exception e) { + // ignore } - }; + // Ensure getSections() called + try { + initEditor.getErrorMessage(); + } catch (Exception e) { + // ignore + } + } + return initEditor; } - public void test02DoSave() { - editor.doSave(null); + public void testDoSave() { + getServerEditorPart().doSave(null); } - public void test03SaveAs() { - editor.doSaveAs(); + public void testSaveAs() { + getServerEditorPart().doSaveAs(); } - public void test04IsDirty() { - editor.isDirty(); + public void testIsDirty() { + getServerEditorPart().isDirty(); } - public void test05IsSaveAsAllowed() { - editor.isSaveAsAllowed(); + public void testIsSaveAsAllowed() { + getServerEditorPart().isSaveAsAllowed(); } - public void test06SetErrorMessage() { - editor.setErrorMessage(null); + public void testSetErrorMessage() { + getServerEditorPart().setErrorMessage(null); } - public void test07UpdateErrorMessage() { - editor.updateErrorMessage(); + public void testUpdateErrorMessage() { + getServerEditorPart().updateErrorMessage(); } - public void test08GetErrorMessage() { + public void testGetErrorMessage() { try { - editor.getErrorMessage(); + getServerEditorPart().getErrorMessage(); } catch (Exception e) { // ignore } } - public void test09GetSaveStatus() { - editor.getSaveStatus(); + public void testGetSaveStatus() { + getServerEditorPart().getSaveStatus(); } - public void test10Init() { - try { - editor.init(null, null); - } catch (Exception e) { - // ignore - } + public void testGetServer() { + getInitializedServerEditorPart().getServer(); } - public void test11GetServer() { - editor.getServer(); - } - - public void test12InsertSections() { - editor.insertSections(null, null); + public void testInsertSections() { + getInitializedServerEditorPart().insertSections(null, null); } - public void test12Dispose() { - editor.dispose(); + public void testDispose() { + getInitializedServerEditorPart().dispose(); + initEditor = null; } - public void test13TestProtectedMethods() { + public void testTestProtectedMethods() { class MyServerEditorPart extends ServerEditorPart { public void testProtected() { try {
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorSectionTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorSectionTestCase.java index 8e99915..3093d0c 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorSectionTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/editor/ServerEditorSectionTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,48 +14,54 @@ import org.eclipse.wst.server.ui.editor.ServerEditorSection; +/* Note: These tests may be executed in any order. Because null is used as most + * arguments, the order doesn't currently matter. If non-null arguments are used, + * it may be necessary to rewrite the tests to make them truly order independent. + */ + public class ServerEditorSectionTestCase extends TestCase { protected static ServerEditorSection section; - public void test00Create() { - section = new ServerEditorSection() { - // do nothing - }; + protected ServerEditorSection getServerEditorSection() { + if (section == null) { + section = new ServerEditorSection() { + // do nothing + }; + // Ensure initialized called, though this is effectively a no-op + section.init(null, null); + } + return section; } - public void test01Init() { - section.init(null, null); + public void testCreateSection() { + getServerEditorSection().createSection(null); } - public void test02CreateSection() { - section.createSection(null); + public void testDispose() { + getServerEditorSection().dispose(); } - public void test03Dispose() { - section.dispose(); + public void testGetErrorMessage() { + getServerEditorSection().getErrorMessage(); } - public void test04GetErrorMessage() { - section.getErrorMessage(); + public void testGetSaveStatus() { + getServerEditorSection().getSaveStatus(); } - public void test05GetSaveStatus() { - section.getSaveStatus(); - } - - public void test06GetShell() { + public void testGetShell() { try { - section.getShell(); + getServerEditorSection().getShell(); } catch (Exception e) { // ignore } } - public void test07SetServerEditorPart() { - section.setServerEditorPart(null); + public void testSetServerEditorPart() { + getServerEditorSection().setServerEditorPart(null); } - public void test08SetErrorMessage() { - section.setErrorMessage(null); + public void testSetErrorMessage() { + getServerEditorSection().setErrorMessage(null); } } \ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/TaskWizardTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/TaskWizardTestCase.java index 485ba99..40f974b 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/TaskWizardTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/TaskWizardTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,142 +14,150 @@ import org.eclipse.wst.server.ui.internal.wizard.TaskWizard; +/* Note: These tests may be executed in any order. Because null is used as most + * arguments, the order doesn't currently matter. If non-null arguments are used, + * it may be necessary to rewrite the tests to make them truly order independent. + */ + public class TaskWizardTestCase extends TestCase { protected static TaskWizard wizard; - public void test00Create() { - wizard = new TaskWizard("title", null, null); + protected TaskWizard getTaskWizard() { + if (wizard == null) { + wizard = new TaskWizard("title", null); + // Ensure pages are not null + wizard.addPages(); + } + return wizard; + } + public void testCreate() { + new TaskWizard("title", null, null); } - public void test02Create() { - wizard = new TaskWizard("title", null); - } - - public void test04GetContainer() { - wizard.getContainer(); + public void testGetContainer() { + getTaskWizard().getContainer(); } - public void test05SetRootFragment() { - wizard.setRootFragment(null); + public void testSetRootFragment() { + getTaskWizard().setRootFragment(null); } - public void test06GetRootFragment() { - wizard.getRootFragment(); + public void testGetRootFragment() { + getTaskWizard().getRootFragment(); } - public void test07PerformCancel() { + public void testPerformCancel() { try { - wizard.performCancel(); + getTaskWizard().performCancel(); } catch (Exception e) { // ignore } } - public void test08PerformFinish() { + public void testPerformFinish() { try { - wizard.performFinish(); + getTaskWizard().performFinish(); } catch (Exception e) { // ignore } } - public void test09AddPage() { + public void testAddPage() { try { - wizard.addPage(null); + getTaskWizard().addPage(null); } catch (Exception e) { // ignore } + // Reset wizard since it now has a null page + wizard = null; } - public void test10AddPages() { - wizard.addPages(); + public void testCanFinish() { + getTaskWizard().canFinish(); } - public void test11CanFinish() { - wizard.canFinish(); + public void testCreatePageControls() { + getTaskWizard().createPageControls(null); } - public void test12CreatePageControls() { - wizard.createPageControls(null); + public void testDispose() { + getTaskWizard().dispose(); + wizard = null; } - public void test13Dispose() { - wizard.dispose(); + public void testGetDefaultPageImage() { + getTaskWizard().getDefaultPageImage(); } - public void test14GetDefaultPageImage() { - wizard.getDefaultPageImage(); + public void testGetDialogSettings() { + getTaskWizard().getDialogSettings(); } - public void test15GetDialogSettings() { - wizard.getDialogSettings(); + public void testGetNextPage() { + getTaskWizard().getNextPage(null); } - public void test16GetNextPage() { - wizard.getNextPage(null); - } - - public void test17GetPage() { - wizard.getPage(null); + public void testGetPage() { + getTaskWizard().getPage(null); } public void test18GetPageCount() { - wizard.getPageCount(); + getTaskWizard().getPageCount(); } - public void test19GetPages() { - wizard.getPages(); + public void testGetPages() { + getTaskWizard().getPages(); } - public void test20GetPreviousPage() { - wizard.getPreviousPage(null); + public void testGetPreviousPage() { + getTaskWizard().getPreviousPage(null); } - public void test21GetStartingPage() { - wizard.getStartingPage(); + public void testGetStartingPage() { + getTaskWizard().getStartingPage(); } - public void test22GetTitleBarColor() { - wizard.getTitleBarColor(); + public void testGetTitleBarColor() { + getTaskWizard().getTitleBarColor(); } - public void test23GetWindowTitle() { - wizard.getWindowTitle(); + public void testGetWindowTitle() { + getTaskWizard().getWindowTitle(); } - public void test24IsHelpAvailable() { - wizard.isHelpAvailable(); + public void testIsHelpAvailable() { + getTaskWizard().isHelpAvailable(); } - public void test25NeedsPreviousAndNextButtons() { - wizard.needsPreviousAndNextButtons(); + public void testNeedsPreviousAndNextButtons() { + getTaskWizard().needsPreviousAndNextButtons(); } - public void test26NeedsProgressMonitor() { - wizard.needsProgressMonitor(); + public void testNeedsProgressMonitor() { + getTaskWizard().needsProgressMonitor(); } - public void test27SetContainer() { - wizard.setContainer(null); + public void testSetContainer() { + getTaskWizard().setContainer(null); } - public void test28SetDialogSettings() { - wizard.setDialogSettings(null); + public void testSetDialogSettings() { + getTaskWizard().setDialogSettings(null); } - public void test29SetNeedsProgressMonitor() { - wizard.setNeedsProgressMonitor(false); + public void testSetNeedsProgressMonitor() { + getTaskWizard().setNeedsProgressMonitor(false); } - public void test30SetForcePreviousAndNextButtons() { - wizard.setForcePreviousAndNextButtons(false); + public void testSetForcePreviousAndNextButtons() { + getTaskWizard().setForcePreviousAndNextButtons(false); } - public void test31SetWindowTitle() { - wizard.setWindowTitle("title"); + public void testSetWindowTitle() { + getTaskWizard().setWindowTitle("title"); } - public void test32TestProtected() { + public void testTestProtected() { class MyTaskWizard extends TaskWizard { public MyTaskWizard() { super(null, null, null);
diff --git a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/WizardFragmentTestCase.java b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/WizardFragmentTestCase.java index 00166b7..338ee2c 100644 --- a/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/WizardFragmentTestCase.java +++ b/tests/org.eclipse.wst.server.ui.tests/src/org/eclipse/wst/server/ui/tests/wizard/WizardFragmentTestCase.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,48 +14,56 @@ import org.eclipse.wst.server.ui.wizard.WizardFragment; +/* Note: These tests may be executed in any order. Because null is used as most + * arguments, the order doesn't currently matter. If non-null arguments are used, + * it may be necessary to rewrite the tests to make them truly order independent. + */ + public class WizardFragmentTestCase extends TestCase { protected static WizardFragment fragment; - public void test00CreateFragment() { - fragment = new WizardFragment() { - // do nothing - }; + protected WizardFragment getWizardFragment() { + if (fragment == null) { + fragment = new WizardFragment() { + // do nothing + }; + } + return fragment; } - public void test01HasComposite() { - fragment.hasComposite(); + public void testHasComposite() { + getWizardFragment().hasComposite(); } - public void test02CreateComposite() { - fragment.createComposite(null, null); + public void testCreateComposite() { + getWizardFragment().createComposite(null, null); } - public void test03SetTaskModel() { - fragment.setTaskModel(null); + public void testSetTaskModel() { + getWizardFragment().setTaskModel(null); } - public void test04GetTaskModel() { - fragment.getTaskModel(); + public void testGetTaskModel() { + getWizardFragment().getTaskModel(); } - public void test05Enter() { - fragment.enter(); + public void testEnter() { + getWizardFragment().enter(); } - public void test06Exit() { - fragment.exit(); + public void testExit() { + getWizardFragment().exit(); } - public void test09GetChildFragments() { - fragment.getChildFragments(); + public void testGetChildFragments() { + getWizardFragment().getChildFragments(); } - public void test10IsComplete() { - fragment.isComplete(); + public void testIsComplete() { + getWizardFragment().isComplete(); } - public void test11TestProtected() { + public void testTestProtected() { class MyWizardFragment extends WizardFragment { public void testProtected() { updateChildFragments();