fix broken test and cleanup junit assertions
Change-Id: I1365bdf3e0dfe5018b7d56fc38be59d7f22a2dca
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
diff --git a/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/performance/ScrollEditorTest.java b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/performance/ScrollEditorTest.java
index 20d6e46..6c0c578 100644
--- a/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/performance/ScrollEditorTest.java
+++ b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/performance/ScrollEditorTest.java
@@ -225,8 +225,8 @@
for (int i= 0; i < runs; i++) {
// 0: assert that we are at the top and the selection at 0
assertEquals("editor must be scrolled to the top before starting", 0, text.getTopIndex());
- assertTrue("selection must be at (0,0) before starting", text.getSelection().x == 0);
- assertTrue("selection must be at (0,0) before starting", text.getSelection().y == 0);
+ assertEquals("selection must be at (0,0) before starting", 0, text.getSelection().x);
+ assertEquals("selection must be at (0,0) before starting", 0, text.getSelection().y);
// 1: post scroll events
long delay= 6000;
Timeout timeout= waiter.restart(delay);
@@ -279,8 +279,8 @@
for (int i= 0; i < runs; i++) {
// 0: assert that we are at the top and the selection at 0
assertEquals("editor must be scrolled to the top before starting", 0, text.getTopIndex());
- assertTrue("selection must be at (0,0) before starting", text.getSelection().x == 0);
- assertTrue("selection must be at (0,0) before starting", text.getSelection().y == 0);
+ assertEquals("selection must be at (0,0) before starting", 0, text.getSelection().x);
+ assertEquals("selection must be at (0,0) before starting", 0, text.getSelection().y);
// 1: post scroll events
long delay= 3000;
diff --git a/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/util/DialogCheck.java b/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/util/DialogCheck.java
index 322ec54..a3dbe5e 100644
--- a/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/util/DialogCheck.java
+++ b/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/util/DialogCheck.java
@@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.jdt.testplugin.util;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
import org.junit.Assert;
@@ -67,9 +67,7 @@
//force the creation of the verify dialog
getShell();
}
- if (_verifyDialog.open(dialog) == IDialogConstants.NO_ID) {
- fail(_verifyDialog.getFailureText());
- }
+ assertNotEquals(_verifyDialog.getFailureText(), IDialogConstants.NO_ID, _verifyDialog.open(dialog));
}
diff --git a/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java b/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java
index d6f2744..058529c 100644
--- a/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java
+++ b/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java
@@ -69,7 +69,7 @@
assertEquals("Expected refactoring descriptor is not equal to actual one:", expectedDescriptor.toString(), actualDescriptor.toString());
}
} catch (UnsupportedEncodingException exception) {
- assertFalse("Unsupported encoding for ByteArrayOutputStream.", false);
+ fail("Unsupported encoding for ByteArrayOutputStream.");
}
}
@@ -79,7 +79,7 @@
try {
assertEquals("The refactoring descriptor has not been correctly serialized:", convertLineDelimiters(xml), stream.toString("utf-8"));
} catch (UnsupportedEncodingException exception) {
- assertFalse("Unsupported encoding for ByteArrayOutputStream.", false);
+ fail("Unsupported encoding for ByteArrayOutputStream.");
}
}