diff options
author | Jeanderson Candido | 2014-04-28 17:07:52 +0000 |
---|---|---|
committer | Lars Vogel | 2014-05-23 10:40:04 +0000 |
commit | 89b764abca5c5d988ed28723d5ed08890bf55470 (patch) | |
tree | fe74b40c2efeb59a911080ea93c7ed85a02f0fc2 | |
parent | 7cc6bbf25e39de29089d87e8f8f6ed44f70104e6 (diff) | |
download | eclipse.platform.ui-89b764abca5c5d988ed28723d5ed08890bf55470.tar.gz eclipse.platform.ui-89b764abca5c5d988ed28723d5ed08890bf55470.tar.xz eclipse.platform.ui-89b764abca5c5d988ed28723d5ed08890bf55470.zip |
Bug 433608 - Clean JFace Unit tests in preparation for GSoc
Removed unnecessary throw statements from WizardTest.
Change-Id: Ie563cf35a40bcad1f142d9b6db38a77e4ac20184
Signed-off-by: Jeanderson Candido <jeandersonbc@gmail.com>
-rw-r--r-- | tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/wizards/WizardTest.java | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/wizards/WizardTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/wizards/WizardTest.java index 4abb0c3ec71..a64a8ffb195 100644 --- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/wizards/WizardTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/wizards/WizardTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 IBM Corporation and others. + * Copyright (c) 2008, 2014 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 @@ -7,12 +7,11 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Jeanderson Candido <http://jeandersonbc.github.io> - Bug 433608 ******************************************************************************/ package org.eclipse.jface.tests.wizards; -import java.io.IOException; - import junit.framework.TestCase; import org.eclipse.core.runtime.IStatus; @@ -52,7 +51,7 @@ public class WizardTest extends TestCase { } - public void testEndingWithFinish() throws IOException { + public void testEndingWithFinish() { //test page count assertEquals("Wizard has wrong number of pages", NUM_PAGES, wizard.getPageCount()); @@ -78,7 +77,7 @@ public class WizardTest extends TestCase { assertSame("Wizard has wrong starting page", wizard.page1, wizard.getStartingPage()); assertSame("Wizard not on starting page", wizard.page1, dialog.getCurrentPage()); - //test getMessage() + //test getMessage() assertSame("WizardPage error message should be null", null, wizard.page1.getErrorMessage()); wizard.page1.textInputField.setText(TheTestWizardPage.BAD_TEXT_FIELD_CONTENTS); assertEquals("WizardPage error message set correctly", TheTestWizardPage.BAD_TEXT_FIELD_STATUS, wizard.page1.getErrorMessage()); @@ -109,7 +108,7 @@ public class WizardTest extends TestCase { assertEquals("Wizard didn't perform finish", true, DID_FINISH); } - public void testEndingWithCancel() throws IOException { + public void testEndingWithCancel() { assertSame("Wizard not on starting page", wizard.page1, dialog.getCurrentPage()); //TheTestWizard's performFinish() sets DID_FINISH to true, ensure it was not called @@ -120,9 +119,9 @@ public class WizardTest extends TestCase { assertEquals("Wizard performed finished but should not have", false, DID_FINISH); } - public void testPageChanging() throws IOException { + public void testPageChanging() { //initially on first page - assertSame("Wizard started on wrong page", wizard.page1, dialog.getCurrentPage()); + assertSame("Wizard started on wrong page", wizard.page1, dialog.getCurrentPage()); assertEquals("Back button should be disabled on first page", false, dialog.getBackButton().getEnabled()); assertEquals("Next button should be enabled on first page", true, dialog.getNextButton().getEnabled()); @@ -155,7 +154,7 @@ public class WizardTest extends TestCase { //move back to page 1 dialog.backPressed(); - assertSame("Wizard.backPressed() set wrong page", wizard.page1, dialog.getCurrentPage()); + assertSame("Wizard.backPressed() set wrong page", wizard.page1, dialog.getCurrentPage()); assertEquals("Back button should be disabled on first page", false, dialog.getBackButton().getEnabled()); assertEquals("Next button should be enabled on first page", true, dialog.getNextButton().getEnabled()); @@ -164,10 +163,10 @@ public class WizardTest extends TestCase { assertSame("Wizard.backPressed() set wrong page", wizard.page2, dialog.getCurrentPage()); //move Back to page 1 dialog.buttonPressed(IDialogConstants.BACK_ID); - assertSame("Wizard.backPressed() set wrong page", wizard.page1, dialog.getCurrentPage()); + assertSame("Wizard.backPressed() set wrong page", wizard.page1, dialog.getCurrentPage()); } - public void testShowPage() throws IOException { + public void testShowPage() { //move to page 3 dialog.nextPressed(); dialog.nextPressed(); @@ -183,18 +182,20 @@ public class WizardTest extends TestCase { assertEquals("Next button should be enabled on first page", true, dialog.getNextButton().getEnabled()); } - public void testPageChangeListening() throws IOException { + public void testPageChangeListening() { pageChanged = false; pageChangingFired = false; IPageChangedListener changedListener = new IPageChangedListener() { + @Override public void pageChanged(PageChangedEvent event) { - pageChanged = true; + pageChanged = true; } }; IPageChangingListener changingListener = new IPageChangingListener() { + @Override public void handlePageChanging(PageChangingEvent event) { assertEquals("Page should not have changed yet", false, pageChanged); pageChangingFired = true; @@ -205,7 +206,7 @@ public class WizardTest extends TestCase { //test that listener notifies us of page change dialog.addPageChangedListener(changedListener); dialog.addPageChangingListener(changingListener); //assert is in the listener - assertEquals("Page change notified unintentially", false, pageChanged); + assertEquals("Page change notified unintentially", false, pageChanged); //change to page 2 dialog.nextPressed(); assertEquals("Wasn't notified of page change", true, pageChanged); @@ -229,6 +230,7 @@ public class WizardTest extends TestCase { final boolean logged[] = new boolean[1]; Policy.setLog(new ILogger() { + @Override public void log(IStatus status) { logged[0] = true; } @@ -245,6 +247,7 @@ public class WizardTest extends TestCase { wizard.page2.setThrowExceptionOnDispose(true); final boolean logged[] = new boolean[1]; Policy.setLog(new ILogger() { + @Override public void log(IStatus status) { logged[0] = true; } @@ -260,6 +263,7 @@ public class WizardTest extends TestCase { //---------------------------------------------------- + @Override protected void setUp() throws Exception { // TODO Auto-generated method stub super.setUp(); @@ -270,13 +274,14 @@ public class WizardTest extends TestCase { createWizardDialog(); } + @Override protected void tearDown() throws Exception { if(dialog.getShell() != null && ! dialog.getShell().isDisposed()) { dialog.close(); - } + } } - //Create and open the wizard + //Create and open the wizard protected void createWizardDialog() { //ensure we've initialized a display for this thread Display.getDefault(); |