aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeanderson Candido2014-04-25 20:09:49 (EDT)
committerLars Vogel2014-04-28 00:42:53 (EDT)
commit25d51df514902194702b3b017ba6967788befc09 (patch)
tree88b202cb54e2e6260af624835b05ea370da082c9
parenteb715d5602d518231277f645e3217faa73159fee (diff)
downloadeclipse.platform.ui-25d51df514902194702b3b017ba6967788befc09.zip
eclipse.platform.ui-25d51df514902194702b3b017ba6967788befc09.tar.gz
eclipse.platform.ui-25d51df514902194702b3b017ba6967788befc09.tar.bz2
Bug 430873 - Cleanup JFace code in preparation for GSocrefs/changes/02/25602/3
Covered packages from JFace Test Suite: - org.eclipse.jface.tests.action - org.eclipse.jface.tests.dialogs Details: - Added @Override annotation and removed unnecessary comments from JFaceActionTest. - Enhanced loops using for-each syntax in StatusDialogTest and DialogSettingsTest; - Replaced sequence of repetitive statements by a for-loop in SafeRunnableErrorTest; - Added @Override annotantion on overriden method in InputDialogTest and DialogTest; Change-Id: I2615cb1609a34c570fdf51c7b954888f460ecf83 Signed-off-by: Jeanderson Candido <jeandersonbc@gmail.com>
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/JFaceActionTest.java10
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java40
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java1
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/InputDialogTest.java3
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/ProgressMonitorDialogTest.java1
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/SafeRunnableErrorTest.java9
-rwxr-xr-xtests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java12
7 files changed, 38 insertions, 38 deletions
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/JFaceActionTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/JFaceActionTest.java
index 72389d8..a703e05 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/JFaceActionTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/JFaceActionTest.java
@@ -35,9 +35,7 @@ public abstract class JFaceActionTest extends TestCase {
super(name);
}
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
+ @Override
protected void setUp() throws Exception {
display = Display.getCurrent();
if (display == null) {
@@ -48,10 +46,8 @@ public abstract class JFaceActionTest extends TestCase {
shell.setLayout(new FillLayout());
shell.open();
}
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
+
+ @Override
protected void tearDown() throws Exception {
shell.dispose();
}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java
index da0a04d..0cf90cf 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogSettingsTest.java
@@ -35,8 +35,8 @@ public class DialogSettingsTest extends TestCase {
"\rvalue\rwith\rreturn\r", };
public void testDialogSettings() throws IOException {
- for (int i = 0; i < TEST_STRINGS.length; i++) {
- final String name = TEST_STRINGS[i];
+ for (String testString : TEST_STRINGS) {
+ final String name = testString;
testPutAndGetWithTitle(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
IDialogSettings dialogSettingsToSerialize) {
@@ -52,8 +52,8 @@ public class DialogSettingsTest extends TestCase {
}
public void testAddNewSection() throws IOException {
- for (int i = 0; i < TEST_STRINGS.length; i++) {
- final String name = TEST_STRINGS[i];
+ for (String testString : TEST_STRINGS) {
+ final String name = testString;
testPutAndGet(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
@@ -205,8 +205,8 @@ public class DialogSettingsTest extends TestCase {
}
public void testKeys() throws IOException {
- for (int i = 0; i < TEST_STRINGS.length; i++) {
- final String key = TEST_STRINGS[i];
+ for (String testString : TEST_STRINGS) {
+ final String key = testString;
testPutAndGet(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
IDialogSettings dialogSettingsToSerialize) {
@@ -226,8 +226,8 @@ public class DialogSettingsTest extends TestCase {
}
public void testGet() throws IOException {
- for (int i = 0; i < TEST_STRINGS.length; i++) {
- final String value = TEST_STRINGS[i];
+ for (String testString : TEST_STRINGS) {
+ final String value = testString;
testPutAndGet(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
@@ -247,10 +247,10 @@ public class DialogSettingsTest extends TestCase {
}
public void testGetArray() throws IOException {
- for (int i = 0; i < TEST_STRINGS.length; i++) {
- final String value1 = TEST_STRINGS[i];
- for (int j = 0; j < TEST_STRINGS.length; j++) {
- final String value2 = TEST_STRINGS[j];
+ for (String testString : TEST_STRINGS) {
+ final String value1 = testString;
+ for (String otherTestString : TEST_STRINGS) {
+ final String value2 = otherTestString;
final String[] value = new String[] { value1, value2 };
testPutAndGet(new DialogSettingsChecker() {
@@ -336,8 +336,8 @@ public class DialogSettingsTest extends TestCase {
Double.MAX_VALUE, Double.MIN_VALUE, Double.NaN,
Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY };
- for (int i = 0; i < values.length; i++) {
- final double value = values[i];
+ for (double testValue : values) {
+ final double value = testValue;
testPutAndGet(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
IDialogSettings dialogSettingsToSerialize) {
@@ -370,8 +370,8 @@ public class DialogSettingsTest extends TestCase {
Float.MAX_VALUE, Float.MIN_VALUE, Float.NaN,
Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY };
- for (int i = 0; i < values.length; i++) {
- final float value = values[i];
+ for (float testValue : values) {
+ final float value = testValue;
testPutAndGet(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
IDialogSettings dialogSettingsToSerialize) {
@@ -403,8 +403,8 @@ public class DialogSettingsTest extends TestCase {
int[] values = new int[] { 36254, 0, 1, -36254, Integer.MAX_VALUE,
Integer.MIN_VALUE };
- for (int i = 0; i < values.length; i++) {
- final int value = values[i];
+ for (int testValue : values) {
+ final int value = testValue;
testPutAndGet(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
@@ -427,8 +427,8 @@ public class DialogSettingsTest extends TestCase {
long[] values = new long[] { 36254L, 0L, 1L, -36254L, Long.MAX_VALUE,
Long.MIN_VALUE };
- for (int i = 0; i < values.length; i++) {
- final long value = values[i];
+ for (long testValue : values) {
+ final long value = testValue;
testPutAndGet(new DialogSettingsChecker() {
public void prepareAndCheckBeforeSerialization(
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java
index 63d59d4..e1fc209 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java
@@ -27,6 +27,7 @@ public class DialogTest extends TestCase {
*/
private Dialog dialog;
+ @Override
protected void tearDown() throws Exception {
if (dialog != null) {
// close the dialog
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/InputDialogTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/InputDialogTest.java
index 0b4e425..c225312 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/InputDialogTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/InputDialogTest.java
@@ -17,7 +17,8 @@ import org.eclipse.jface.dialogs.InputDialog;
public class InputDialogTest extends TestCase {
private InputDialog dialog;
-
+
+ @Override
protected void tearDown() throws Exception {
if (dialog != null) {
dialog.close();
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/ProgressMonitorDialogTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/ProgressMonitorDialogTest.java
index 6d4016d..acca009 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/ProgressMonitorDialogTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/ProgressMonitorDialogTest.java
@@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Display;
public class ProgressMonitorDialogTest extends TestCase {
+ @Override
protected void setUp() throws Exception {
super.setUp();
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/SafeRunnableErrorTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/SafeRunnableErrorTest.java
index 8a17139..74d01b3 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/SafeRunnableErrorTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/SafeRunnableErrorTest.java
@@ -64,10 +64,11 @@ public class SafeRunnableErrorTest extends TestCase {
};
// Make sure these don't block
- SafeRunnable.run(runnable);
- SafeRunnable.run(runnable);
- SafeRunnable.run(runnable);
- assertEquals(3, count);
+ int expectedRuns = 3;
+ for (int run = 0; run < expectedRuns; run++) {
+ SafeRunnable.run(runnable);
+ }
+ assertEquals(expectedRuns, count);
}
}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java
index f7d5261..ac42840 100755
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java
@@ -47,15 +47,15 @@ public class StatusDialogTest extends TestCase {
private CLabel findStatusLabel(Composite parent) {
CLabel result = null;
Control[] children = parent.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof CLabel) {
- result = (CLabel) children[i];
+ for (Control child : children) {
+ if (child instanceof CLabel) {
+ result = (CLabel) child;
}
}
if (result == null) {
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof Composite) {
- result = findStatusLabel((Composite) children[i]);
+ for (Control child : children) {
+ if (child instanceof Composite) {
+ result = findStatusLabel((Composite) child);
}
}
}