diff --git a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
index 1ad4315b24f..81d0f8a2c8c 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
+++ b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
@@ -478,6 +478,27 @@
name="swt-link-foreground-color">
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java
index e7b277381d1..ea81535eabc 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java
@@ -76,7 +76,9 @@ public class CSSSWTConstants {
public static final String BUTTON_SELECTED_LISTENER = "org.eclipse.e4.ui.css.swt.BUTTON_SELECTED_LISTENER";
-
-
+ /**
+ * Constant used to store color for SVG filter into SWT widget data.
+ */
+ public static final String CSS_SVG_FILTER_COLOR = "org.eclipse.e4.ui.css.swt.svg.filter.color";
}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java
index f6bdcfc892c..f5065454c8c 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java
@@ -17,8 +17,11 @@
import java.net.URL;
import org.eclipse.e4.ui.css.core.util.resources.IResourcesLocatorManager;
import org.eclipse.e4.ui.css.core.utils.StringUtils;
+import org.eclipse.e4.ui.css.swt.CSSSWTConstants;
+import org.eclipse.jface.resource.ColorMatrix;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
@@ -38,6 +41,11 @@ public class CSSSWTImageHelper {
public static Image getImage(CSSValue value,
IResourcesLocatorManager manager, Display display) throws Exception {
+ return getImage(value, manager, display, null);
+ }
+
+ public static Image getImage(CSSValue value, IResourcesLocatorManager manager, Display display, Widget widget)
+ throws Exception {
if (value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE) {
return null;
}
@@ -45,18 +53,27 @@ public static Image getImage(CSSValue value,
switch (primitiveValue.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_URI:
String path = primitiveValue.getStringValue();
- return loadImageFromURL(path, manager);
+ return loadImageFromURL(path, manager, widget);
}
return null;
}
- private static Image loadImageFromURL(String path,
- IResourcesLocatorManager manager) throws Exception {
+ private static Image loadImageFromURL(String path, IResourcesLocatorManager manager, Widget widget)
+ throws Exception {
Image result = null;
String s = manager.resolve(path);
if (!StringUtils.isEmpty(s)) {
- result = ImageDescriptor.createFromURL(new URL(s)).createImage();
+ ImageDescriptor desc = ImageDescriptor.createFromURL(new URL(s));
+ if (widget != null && s.endsWith(".svg")) { //$NON-NLS-1$
+ RGB filterColor = (RGB) widget.getData(CSSSWTConstants.CSS_SVG_FILTER_COLOR);
+ if (filterColor != null) {
+ desc = ImageDescriptor.createWithColorMatrix(desc,
+ new ColorMatrix(new float[] { 0, 0, 0, 0, filterColor.red / 255f, 0, 0, 0, 0,
+ filterColor.green / 255f, 0, 0, 0, 0, filterColor.blue / 255f, 0, 0, 0, 1, 0 }));
+ }
+ }
+ result = desc.createImage();
}
return result;
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java
index 04d0c62cd2d..a9d914e82eb 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java
@@ -20,6 +20,7 @@
import org.eclipse.e4.ui.css.swt.helpers.CSSSWTImageHelper;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.css.CSSValue;
public class CSSValueSWTImageConverterImpl extends AbstractCSSValueConverter {
@@ -33,9 +34,19 @@ public CSSValueSWTImageConverterImpl() {
@Override
public Object convert(CSSValue value, CSSEngine engine, Object context)
throws Exception {
- Display display = (Display) context;
+ Display display = null;
+ Widget widget = null;
+ if (context instanceof Display) {
+ display = (Display) context;
+ } else if (context instanceof Widget) {
+ widget = (Widget) context;
+ display = widget.getDisplay();
+ }
+ if (display == null) {
+ return null;
+ }
return CSSSWTImageHelper.getImage(value, engine
- .getResourcesLocatorManager(), display);
+ .getResourcesLocatorManager(), display, widget);
}
@Override
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java
index 14ace740aa8..6652b9c32f4 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java
@@ -113,8 +113,7 @@ public void applyCSSPropertyBackgroundImage(Object element, CSSValue value,
String pseudo, CSSEngine engine) throws Exception {
// Widget control = (Widget) element;
Widget widget = (Widget) ((WidgetElement) element).getNativeWidget();
- Image image = (Image) engine.convert(value, Image.class,
- widget.getDisplay());
+ Image image = (Image) engine.convert(value, Image.class, widget);
if (widget instanceof CTabFolder && "selected".equals(pseudo)) {
((CTabFolder) widget).setSelectionBackground(image);
} else if (widget instanceof Button button) {
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java
new file mode 100644
index 00000000000..3fb959f2461
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2021, 2025 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.e4.ui.css.swt.properties.custom;
+
+import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
+import org.eclipse.e4.ui.css.core.engine.CSSEngine;
+import org.eclipse.e4.ui.css.swt.CSSSWTConstants;
+import org.eclipse.e4.ui.css.swt.helpers.SWTElementHelpers;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Widget;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.CSSValue;
+import org.w3c.dom.css.CSSValueList;
+
+public class CSSPropertySVGFilterSWTHandler implements ICSSPropertyHandler {
+
+ @Override
+ public boolean applyCSSProperty(Object element, String property, CSSValue value, String pseudo, CSSEngine engine)
+ throws Exception {
+ Widget widget = SWTElementHelpers.getWidget(element);
+ if (widget == null) {
+ return false;
+ }
+ if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
+ CSSValueList list = (CSSValueList) value;
+ if (list.getLength() == 2) {
+ CSSValue first = list.item(0);
+ if (first instanceof CSSPrimitiveValue) {
+ String text = ((CSSPrimitiveValue) first).getStringValue();
+ if ("color".equalsIgnoreCase(text)) { //$NON-NLS-1$
+ CSSValue second = list.item(1);
+ Color color = (Color) engine.convert(second, Color.class, widget.getDisplay());
+ if (color != null) {
+ widget.setData(CSSSWTConstants.CSS_SVG_FILTER_COLOR, color.getRGB());
+ return true;
+ }
+ }
+ }
+ }
+ }
+ if (value instanceof CSSPrimitiveValue) {
+ String text = ((CSSPrimitiveValue) value).getStringValue();
+ if ("none".equalsIgnoreCase(text)) { //$NON-NLS-1$
+ widget.setData(CSSSWTConstants.CSS_SVG_FILTER_COLOR, null);
+ return true;
+ }
+ // Handle single color value as well, just in case
+ Color color = (Color) engine.convert(value, Color.class, widget.getDisplay());
+ if (color != null) {
+ widget.setData(CSSSWTConstants.CSS_SVG_FILTER_COLOR, color.getRGB());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String retrieveCSSProperty(Object element, String property, String pseudo, CSSEngine engine)
+ throws Exception {
+ Widget widget = SWTElementHelpers.getWidget(element);
+ if (widget != null) {
+ Object data = widget.getData(CSSSWTConstants.CSS_SVG_FILTER_COLOR);
+ if (data != null) {
+ return "color " + data.toString(); //$NON-NLS-1$
+ }
+ }
+ return "none"; //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java
new file mode 100644
index 00000000000..e23c6670037
--- /dev/null
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2021, 2025 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jface.resource;
+
+import java.util.Arrays;
+
+/**
+ * A color matrix is a 5x4 matrix that can be used to transform colors of an
+ * image.
+ *
+ * @since 3.24
+ */
+public final class ColorMatrix {
+ private final float[] matrix;
+
+ /**
+ * Creates a new color matrix from the given 20 elements.
+ *
+ * @param matrix the 20 elements of the matrix
+ * @throws IllegalArgumentException if the matrix does not have 20 elements
+ */
+ public ColorMatrix(float[] matrix) {
+ if (matrix.length != 20) {
+ throw new IllegalArgumentException("Matrix must have 20 elements"); //$NON-NLS-1$
+ }
+ this.matrix = Arrays.copyOf(matrix, 20);
+ }
+
+ /**
+ * Returns the 20 elements of the matrix.
+ *
+ * @return the matrix elements
+ */
+ public float[] getMatrix() {
+ return Arrays.copyOf(matrix, 20);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof ColorMatrix other)) {
+ return false;
+ }
+ return Arrays.equals(matrix, other.matrix);
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(matrix);
+ }
+
+ @Override
+ public String toString() {
+ return "ColorMatrix " + Arrays.toString(matrix); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java
new file mode 100644
index 00000000000..238a1ca83ab
--- /dev/null
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2021, 2025 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jface.resource;
+
+import java.util.Objects;
+
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ * An image descriptor that applies a color matrix to another image descriptor.
+ */
+final class ColorMatrixImageDescriptor extends ImageDescriptor {
+ private final ImageDescriptor original;
+ private final ColorMatrix matrix;
+
+ ColorMatrixImageDescriptor(ImageDescriptor original, ColorMatrix matrix) {
+ super(original.shouldBeCached());
+ this.original = original;
+ this.matrix = Objects.requireNonNull(matrix);
+ }
+
+ @Override
+ public ImageData getImageData(int zoom) {
+ ImageData data = original.getImageData(zoom);
+ if (data == null) {
+ return null;
+ }
+ float[] m = matrix.getMatrix();
+
+ ImageData result = (ImageData) data.clone();
+ PaletteData palette = result.palette;
+ if (palette.isDirect) {
+ for (int y = 0; y < result.height; y++) {
+ for (int x = 0; x < result.width; x++) {
+ int pixel = result.getPixel(x, y);
+ int alpha = result.getAlpha(x, y);
+
+ float r = ((pixel & palette.redMask) >>> Math.abs(palette.redShift)) / 255f;
+ float g = ((pixel & palette.greenMask) >>> Math.abs(palette.greenShift)) / 255f;
+ float b = ((pixel & palette.blueMask) >>> Math.abs(palette.blueShift)) / 255f;
+ float a = alpha / 255f;
+
+ float nr = m[0] * r + m[1] * g + m[2] * b + m[3] * a + m[4];
+ float ng = m[5] * r + m[6] * g + m[7] * b + m[8] * a + m[9];
+ float nb = m[10] * r + m[11] * g + m[12] * b + m[13] * a + m[14];
+ float na = m[15] * r + m[16] * g + m[17] * b + m[18] * a + m[19];
+
+ int inr = Math.min(255, Math.max(0, Math.round(nr * 255)));
+ int ing = Math.min(255, Math.max(0, Math.round(ng * 255)));
+ int inb = Math.min(255, Math.max(0, Math.round(nb * 255)));
+ int ina = Math.min(255, Math.max(0, Math.round(na * 255)));
+
+ int newPixel = (inr << Math.abs(palette.redShift)) & palette.redMask
+ | (ing << Math.abs(palette.greenShift)) & palette.greenMask
+ | (inb << Math.abs(palette.blueShift)) & palette.blueMask;
+
+ result.setPixel(x, y, newPixel);
+ result.setAlpha(x, y, ina);
+ }
+ }
+ } else {
+ // Indexed palette
+ RGB[] rgbs = palette.getRGBs();
+ RGB[] newRgbs = new RGB[rgbs.length];
+ for (int i = 0; i < rgbs.length; i++) {
+ RGB rgb = rgbs[i];
+ float r = rgb.red / 255f;
+ float g = rgb.green / 255f;
+ float b = rgb.blue / 255f;
+ float a = 1f; // Indexed palette doesn't have per-pixel alpha usually, or it's handled separately
+
+ float nr = m[0] * r + m[1] * g + m[2] * b + m[3] * a + m[4];
+ float ng = m[5] * r + m[6] * g + m[7] * b + m[8] * a + m[9];
+ float nb = m[10] * r + m[11] * g + m[12] * b + m[13] * a + m[14];
+
+ int inr = Math.min(255, Math.max(0, Math.round(nr * 255)));
+ int ing = Math.min(255, Math.max(0, Math.round(ng * 255)));
+ int inb = Math.min(255, Math.max(0, Math.round(nb * 255)));
+
+ newRgbs[i] = new RGB(inr, ing, inb);
+ }
+ result.palette = new PaletteData(newRgbs);
+ // Alpha is still per-pixel in ImageData even for indexed palettes
+ for (int y = 0; y < result.height; y++) {
+ for (int x = 0; x < result.width; x++) {
+ int alpha = result.getAlpha(x, y);
+ float a = alpha / 255f;
+ float na = m[15] * 0 + m[16] * 0 + m[17] * 0 + m[18] * a + m[19]; // Simplified
+ int ina = Math.min(255, Math.max(0, Math.round(na * 255)));
+ result.setAlpha(x, y, ina);
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof ColorMatrixImageDescriptor other)) {
+ return false;
+ }
+ return original.equals(other.original) && matrix.equals(other.matrix);
+ }
+
+ @Override
+ public int hashCode() {
+ return original.hashCode() ^ matrix.hashCode();
+ }
+}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
index 5c658690766..aedaaf22eab 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
@@ -169,6 +169,26 @@ public static ImageDescriptor createWithFlags(ImageDescriptor originalImage, int
return new DerivedImageDescriptor(originalImage, swtFlags);
}
+ /**
+ * Creates an ImageDescriptor based on the given original descriptor, but with a
+ * color matrix filter applied.
+ *
+ *
+ * Note that this sort of ImageDescriptor is slower and consumes more resources
+ * than a regular image descriptor. It will also never generate results that
+ * look as nice as a hand-drawn image.
+ *
+ *
+ * @param originalImage image to transform
+ * @param matrix the color matrix to apply
+ * @return an ImageDescriptor that creates new images by transforming the given
+ * image descriptor
+ * @since 3.24
+ */
+ public static ImageDescriptor createWithColorMatrix(ImageDescriptor originalImage, ColorMatrix matrix) {
+ return new ColorMatrixImageDescriptor(originalImage, matrix);
+ }
+
/**
* Creates and returns a new image descriptor for the given image. This
* method takes the Device that created the Image as an argument, allowing
diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java
index 2e3300d0c22..1a86593f618 100644
--- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java
+++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java
@@ -3932,7 +3932,7 @@ private PerspectiveDescriptor fixOrphanPerspective(MPerspective mperspective) {
String perspId = mperspective.getElementId();
String label = mperspective.getLabel();
String msg = "Perspective with name '" + label + "' and id '" + perspId + "' has been made into a local copy"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- IStatus status = StatusUtil.newStatus(IStatus.WARNING, msg, null);
+ IStatus status = StatusUtil.newStatus(IStatus.INFO, msg, null);
StatusManager.getManager().handle(status, StatusManager.LOG);
String newDescId = NLS.bind(WorkbenchMessages.Perspective_localCopyLabel, label);
diff --git a/examples/org.eclipse.e4.demo.cssbridge/icons/app.gif b/examples/org.eclipse.e4.demo.cssbridge/icons/app.gif
deleted file mode 100644
index 34fb3c9d8cb..00000000000
Binary files a/examples/org.eclipse.e4.demo.cssbridge/icons/app.gif and /dev/null differ
diff --git a/examples/org.eclipse.e4.demo.cssbridge/icons/app.svg b/examples/org.eclipse.e4.demo.cssbridge/icons/app.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.e4.demo.cssbridge/icons/app.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.e4.demo.cssbridge/plugin.xml b/examples/org.eclipse.e4.demo.cssbridge/plugin.xml
index 05d006814a0..2198f2cf23c 100644
--- a/examples/org.eclipse.e4.demo.cssbridge/plugin.xml
+++ b/examples/org.eclipse.e4.demo.cssbridge/plugin.xml
@@ -73,7 +73,7 @@
name="%product.name">
+ value="icons/app.svg">
+
+
+
diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/sample.gif b/examples/org.eclipse.e4.ui.examples.job/icons/sample.gif
deleted file mode 100644
index 34fb3c9d8cb..00000000000
Binary files a/examples/org.eclipse.e4.ui.examples.job/icons/sample.gif and /dev/null differ
diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/sample.svg b/examples/org.eclipse.e4.ui.examples.job/icons/sample.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.e4.ui.examples.job/icons/sample.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/suspend.gif b/examples/org.eclipse.e4.ui.examples.job/icons/suspend.gif
deleted file mode 100644
index 0d71e428d79..00000000000
Binary files a/examples/org.eclipse.e4.ui.examples.job/icons/suspend.gif and /dev/null differ
diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg b/examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg
new file mode 100644
index 00000000000..ddac8b192ab
--- /dev/null
+++ b/examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg
@@ -0,0 +1,74 @@
+
+
+
+
diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.gif b/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.gif
deleted file mode 100644
index ce8bdb99b73..00000000000
Binary files a/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.gif and /dev/null differ
diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg b/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg
new file mode 100644
index 00000000000..41d3f9068b8
--- /dev/null
+++ b/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg
@@ -0,0 +1,356 @@
+
+
+
+
diff --git a/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi b/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi
index 32374d1a321..f854a264d80 100644
--- a/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi
+++ b/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi
@@ -1,7 +1,7 @@
-
+ ViewcategoryTag:General
diff --git a/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java b/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java
index 4a0e214a6e2..3f9c0a3b9c7 100644
--- a/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java
+++ b/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java
@@ -72,8 +72,7 @@ public TestJob(long duration, boolean lock, boolean failure,
this.rescheduleWait = rescheduleWait;
setProperty(IProgressConstants.ICON_PROPERTY,
- getImageDescriptor("icons/sample.gif"));
- if (lock)
+ getImageDescriptor("icons/sample.svg")); if (lock)
setRule(ResourcesPlugin.getWorkspace().getRoot());
}
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/change_obj.gif b/examples/org.eclipse.ui.examples.contributions/icons/change_obj.gif
deleted file mode 100755
index ce8bdb99b73..00000000000
Binary files a/examples/org.eclipse.ui.examples.contributions/icons/change_obj.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg b/examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg
new file mode 100644
index 00000000000..452fceb540a
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg
@@ -0,0 +1,113 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/editor.gif b/examples/org.eclipse.ui.examples.contributions/icons/editor.gif
deleted file mode 100755
index c48d9a95677..00000000000
Binary files a/examples/org.eclipse.ui.examples.contributions/icons/editor.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/editor.svg b/examples/org.eclipse.ui.examples.contributions/icons/editor.svg
new file mode 100644
index 00000000000..fbad0ece47f
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.contributions/icons/editor.svg
@@ -0,0 +1,294 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.gif b/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.gif
deleted file mode 100644
index 7aea894d0b6..00000000000
Binary files a/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg b/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg
new file mode 100644
index 00000000000..d080de794e2
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg
@@ -0,0 +1,546 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/perspective.gif b/examples/org.eclipse.ui.examples.contributions/icons/perspective.gif
deleted file mode 100644
index 008fd7ada9a..00000000000
Binary files a/examples/org.eclipse.ui.examples.contributions/icons/perspective.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/perspective.svg b/examples/org.eclipse.ui.examples.contributions/icons/perspective.svg
new file mode 100644
index 00000000000..785099ef482
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.contributions/icons/perspective.svg
@@ -0,0 +1,292 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/sample.gif b/examples/org.eclipse.ui.examples.contributions/icons/sample.gif
deleted file mode 100644
index 34fb3c9d8cb..00000000000
Binary files a/examples/org.eclipse.ui.examples.contributions/icons/sample.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/sample.svg b/examples/org.eclipse.ui.examples.contributions/icons/sample.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.contributions/icons/sample.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/sample2.gif b/examples/org.eclipse.ui.examples.contributions/icons/sample2.gif
deleted file mode 100644
index 252d7ebcb8c..00000000000
Binary files a/examples/org.eclipse.ui.examples.contributions/icons/sample2.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.contributions/icons/sample2.svg b/examples/org.eclipse.ui.examples.contributions/icons/sample2.svg
new file mode 100644
index 00000000000..35549c7190d
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.contributions/icons/sample2.svg
@@ -0,0 +1,168 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.contributions/plugin.xml b/examples/org.eclipse.ui.examples.contributions/plugin.xml
index 96fe1f863d5..ab7e462527e 100644
--- a/examples/org.eclipse.ui.examples.contributions/plugin.xml
+++ b/examples/org.eclipse.ui.examples.contributions/plugin.xml
@@ -162,7 +162,7 @@
id="org.eclipse.ui.examples.contributions.toolbars.sampleToolbar">
@@ -249,7 +249,7 @@
locationURI="toolbar:org.eclipse.ui.examples.contributions.view?after=additions">
@@ -485,7 +485,7 @@
id="org.eclipse.ui.examples.contributions.editor.toolbar">
@@ -529,7 +529,7 @@
@@ -594,7 +594,7 @@
@@ -607,7 +607,7 @@
name="%info.product.name">
+ value="icons/sample2.svg">
+ value="product_lg.svg">
+
+
+
diff --git a/examples/org.eclipse.ui.examples.javaeditor/icons/sample.gif b/examples/org.eclipse.ui.examples.javaeditor/icons/sample.gif
deleted file mode 100644
index 34fb3c9d8cb..00000000000
Binary files a/examples/org.eclipse.ui.examples.javaeditor/icons/sample.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.javaeditor/icons/sample.svg b/examples/org.eclipse.ui.examples.javaeditor/icons/sample.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.javaeditor/icons/sample.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.job/icons/job_view.gif b/examples/org.eclipse.ui.examples.job/icons/job_view.gif
deleted file mode 100644
index 81fb7b4a39d..00000000000
Binary files a/examples/org.eclipse.ui.examples.job/icons/job_view.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.job/icons/job_view.svg b/examples/org.eclipse.ui.examples.job/icons/job_view.svg
new file mode 100644
index 00000000000..52d9348e1ac
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.job/icons/job_view.svg
@@ -0,0 +1,384 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.job/icons/sample.gif b/examples/org.eclipse.ui.examples.job/icons/sample.gif
deleted file mode 100644
index 34fb3c9d8cb..00000000000
Binary files a/examples/org.eclipse.ui.examples.job/icons/sample.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.job/icons/sample.svg b/examples/org.eclipse.ui.examples.job/icons/sample.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.job/icons/sample.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.job/icons/suspend.gif b/examples/org.eclipse.ui.examples.job/icons/suspend.gif
deleted file mode 100644
index 0d71e428d79..00000000000
Binary files a/examples/org.eclipse.ui.examples.job/icons/suspend.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.job/icons/suspend.svg b/examples/org.eclipse.ui.examples.job/icons/suspend.svg
new file mode 100644
index 00000000000..ddac8b192ab
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.job/icons/suspend.svg
@@ -0,0 +1,74 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.job/icons/tree_view.gif b/examples/org.eclipse.ui.examples.job/icons/tree_view.gif
deleted file mode 100644
index ce8bdb99b73..00000000000
Binary files a/examples/org.eclipse.ui.examples.job/icons/tree_view.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.job/icons/tree_view.svg b/examples/org.eclipse.ui.examples.job/icons/tree_view.svg
new file mode 100644
index 00000000000..41d3f9068b8
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.job/icons/tree_view.svg
@@ -0,0 +1,356 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.job/plugin.xml b/examples/org.eclipse.ui.examples.job/plugin.xml
index 229c50aaafc..e47120c25ae 100644
--- a/examples/org.eclipse.ui.examples.job/plugin.xml
+++ b/examples/org.eclipse.ui.examples.job/plugin.xml
@@ -10,14 +10,14 @@
@@ -56,7 +56,7 @@
+
+
+
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml b/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml
index 377e097e7f3..cfa70406956 100644
--- a/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml
+++ b/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml
@@ -6,7 +6,7 @@
point="org.eclipse.ui.editors">
+
+
+
diff --git a/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.gif b/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.gif
deleted file mode 100644
index 4b98a62c6ee..00000000000
Binary files a/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg b/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg
new file mode 100644
index 00000000000..b807be35b21
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg
@@ -0,0 +1,204 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.gif b/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.gif
deleted file mode 100644
index d11c996e570..00000000000
Binary files a/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg b/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg
new file mode 100644
index 00000000000..79429f17cd4
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg
@@ -0,0 +1,261 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.navigator/plugin.xml b/examples/org.eclipse.ui.examples.navigator/plugin.xml
index 37b290ef042..0ccb8d4b5d1 100644
--- a/examples/org.eclipse.ui.examples.navigator/plugin.xml
+++ b/examples/org.eclipse.ui.examples.navigator/plugin.xml
@@ -12,7 +12,7 @@
@@ -95,7 +95,7 @@
contentProvider="org.eclipse.ui.examples.navigator.PropertiesContentProvider"
labelProvider="org.eclipse.ui.examples.navigator.PropertiesLabelProvider"
activeByDefault="true"
- icon="icons/prop_ps.gif"
+ icon="icons/prop_ps.svg"
priority="normal" >
@@ -141,7 +141,7 @@
class="org.eclipse.ui.examples.navigator.actions.DeletePropertyAction"
enablesFor="1"
helpContextId="org.eclipse.ui.edit.delete"
- icon="icons/delete_obj.gif"
+ icon="icons/delete_obj.svg"
id="org.eclipse.ui.examples.navigator.actions.deleteProperty"
label="Delete Property"
menubarPath="group.edit"
diff --git a/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif b/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif
deleted file mode 100644
index 64d79074260..00000000000
Binary files a/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.svg b/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.propertysheet/plugin.xml b/examples/org.eclipse.ui.examples.propertysheet/plugin.xml
index d834a9e3a07..b45fc2edb9e 100644
--- a/examples/org.eclipse.ui.examples.propertysheet/plugin.xml
+++ b/examples/org.eclipse.ui.examples.propertysheet/plugin.xml
@@ -6,7 +6,7 @@
point="org.eclipse.ui.editors">
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif
deleted file mode 100644
index 6d40439b49c..00000000000
Binary files a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.svg b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.svg
new file mode 100644
index 00000000000..f54418d7a7c
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.svg
@@ -0,0 +1,234 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif
deleted file mode 100644
index c48d9a95677..00000000000
Binary files a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg
new file mode 100644
index 00000000000..fbad0ece47f
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg
@@ -0,0 +1,294 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif
deleted file mode 100644
index 293826dfe06..00000000000
Binary files a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.svg b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.svg
new file mode 100644
index 00000000000..d080de794e2
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.svg
@@ -0,0 +1,546 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif
deleted file mode 100644
index 64d79074260..00000000000
Binary files a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.svg b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif b/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif
deleted file mode 100644
index 008fd7ada9a..00000000000
Binary files a/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.svg b/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.svg
new file mode 100644
index 00000000000..41d3f9068b8
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.svg
@@ -0,0 +1,356 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.readmetool/plugin.xml b/examples/org.eclipse.ui.examples.readmetool/plugin.xml
index 21c94a86a6c..0cfaf8efd16 100644
--- a/examples/org.eclipse.ui.examples.readmetool/plugin.xml
+++ b/examples/org.eclipse.ui.examples.readmetool/plugin.xml
@@ -45,7 +45,7 @@
toolbarPath="readme"
class="org.eclipse.ui.examples.readmetool.WindowActionDelegate"
enablesFor="1"
- icon="$nl$/icons/ctool16/openbrwsr.gif"
+ icon="$nl$/icons/ctool16/openbrwsr.svg"
helpContextId="org.eclipse.ui.examples.readmetool.open_browser_action_context"
label="%ReadmeAction.label"
menubarPath="window/org_eclipse_ui_examples_readmetool/slot1"
@@ -57,7 +57,7 @@
@@ -103,7 +103,7 @@
point="org.eclipse.ui.editors">
@@ -165,7 +165,7 @@
id="org.eclipse.ui.examples.readmetool">
+
+
+
diff --git a/examples/org.eclipse.ui.examples.undo/plugin.xml b/examples/org.eclipse.ui.examples.undo/plugin.xml
index 37f1aa581ac..6902ed5c262 100644
--- a/examples/org.eclipse.ui.examples.undo/plugin.xml
+++ b/examples/org.eclipse.ui.examples.undo/plugin.xml
@@ -24,7 +24,7 @@
@@ -38,7 +38,7 @@
id="org.eclipse.ui.examples.undo"/>
diff --git a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.gif b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.gif
deleted file mode 100644
index 34fb3c9d8cb..00000000000
Binary files a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.svg b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml
index 4e77ea38c22..0786130a25b 100644
--- a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml
+++ b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml
@@ -10,7 +10,7 @@
diff --git a/examples/org.eclipse.ui.forms.examples/icons/file_obj.gif b/examples/org.eclipse.ui.forms.examples/icons/file_obj.gif
deleted file mode 100644
index 6b86d079780..00000000000
Binary files a/examples/org.eclipse.ui.forms.examples/icons/file_obj.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.forms.examples/icons/file_obj.svg b/examples/org.eclipse.ui.forms.examples/icons/file_obj.svg
new file mode 100644
index 00000000000..fbad0ece47f
--- /dev/null
+++ b/examples/org.eclipse.ui.forms.examples/icons/file_obj.svg
@@ -0,0 +1,294 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.forms.examples/icons/sample.gif b/examples/org.eclipse.ui.forms.examples/icons/sample.gif
deleted file mode 100644
index 34fb3c9d8cb..00000000000
Binary files a/examples/org.eclipse.ui.forms.examples/icons/sample.gif and /dev/null differ
diff --git a/examples/org.eclipse.ui.forms.examples/icons/sample.svg b/examples/org.eclipse.ui.forms.examples/icons/sample.svg
new file mode 100644
index 00000000000..366f35987f6
--- /dev/null
+++ b/examples/org.eclipse.ui.forms.examples/icons/sample.svg
@@ -0,0 +1,312 @@
+
+
+
+
diff --git a/examples/org.eclipse.ui.forms.examples/plugin.xml b/examples/org.eclipse.ui.forms.examples/plugin.xml
index 843bbf77e6d..400c85b931d 100644
--- a/examples/org.eclipse.ui.forms.examples/plugin.xml
+++ b/examples/org.eclipse.ui.forms.examples/plugin.xml
@@ -48,14 +48,14 @@
diff --git a/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF
index 815803d2626..22e2c1d34bb 100644
--- a/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF
@@ -5,8 +5,7 @@ Bundle-SymbolicName: org.eclipse.jface.tests
Bundle-Version: 1.5.0.qualifier
Automatic-Module-Name: org.eclipse.jface.tests
Bundle-RequiredExecutionEnvironment: JavaSE-21
-Require-Bundle: org.junit;bundle-version="4.12.0",
- org.eclipse.jface,
+Require-Bundle: org.eclipse.jface,
org.eclipse.equinox.registry,
org.eclipse.core.runtime,
org.eclipse.ui,
@@ -14,6 +13,7 @@ Require-Bundle: org.junit;bundle-version="4.12.0",
Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)",
org.junit.jupiter.api.extension;version="[5.14.0,6.0.0)",
org.junit.jupiter.api.function;version="[5.14.0,6.0.0)",
+ org.junit.jupiter.api.io;version="[5.14.0,6.0.0)",
org.junit.platform.commons.function;version="[1.14.0,2.0.0)",
org.junit.platform.suite.api;version="[1.14.0,2.0.0)",
org.opentest4j;version="1.3.0",
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java
index af6efa208cb..95e2e122fba 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java
@@ -13,8 +13,6 @@
*******************************************************************************/
package org.eclipse.jface.tests.action;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -23,8 +21,4 @@
MenuManagerTest.class })
public class AllActionTests {
- public static void main(String[] args) {
- JUnitCore.main(AllActionTests.class.getName());
- }
-
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java
deleted file mode 100644
index cca0e044442..00000000000
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2023 vogella GmbH and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Lars Vogel - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.action;
-
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-/**
- * Junit4 rule for all JFace action tests.
- *
- * @since 3.1
- */
-public class JFaceActionRule implements TestRule {
-
- private Display display;
- private Shell shell;
-
- @Override
- public Statement apply(final Statement base, final Description description) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- display = Display.getCurrent();
- if (display == null) {
- display = new Display();
- }
- shell = new Shell(display);
- shell.setSize(500, 500);
- shell.setLayout(new FillLayout());
- shell.open();
-
- try {
- base.evaluate(); // This will run the test.
- } finally {
- shell.dispose();
- }
- }
- };
- }
-
- protected Shell getShell() {
- return shell;
- }
-
-}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java
index f3d9e4f4d32..889b98522b4 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java
@@ -52,6 +52,7 @@ public class ToolBarManagerTest {
@RegisterExtension
public JFaceActionExtension rule = new JFaceActionExtension();
+ @Test
public void testSetStyleWhenToolBarDoesNotExist() {
Composite parent = createComposite();
ToolBarManager manager = new ToolBarManager(DEFAULT_STYLE | SWT.HORIZONTAL);
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java
index 89c89fe99d6..bfc49dbf04a 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java
@@ -13,8 +13,6 @@
*******************************************************************************/
package org.eclipse.jface.tests.dialogs;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -24,7 +22,4 @@
ProgressMonitorDialogTest.class, PlainMessageDialogTest.class })
public class AllDialogTests {
- public static void main(String[] args) {
- JUnitCore.main(AllDialogTests.class.getName());
- }
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java
index 116bdd077e5..e28fbf6a001 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java
@@ -14,9 +14,9 @@
******************************************************************************/
package org.eclipse.jface.tests.fieldassist;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.swt.SWT;
@@ -24,15 +24,11 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TestWatcher;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
public abstract class AbstractFieldAssistTestCase {
- @Rule
- public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
+
/**
* The window that is being tested.
@@ -49,7 +45,7 @@ public abstract class AbstractFieldAssistTestCase {
*/
private int originalShellCount;
- @Before
+ @BeforeEach
public final void setUp() throws Exception {
Display display = getDisplay();
anotherShell = new Shell(display);
@@ -61,7 +57,7 @@ public final void setUp() throws Exception {
assertNotNull(window);
}
- @After
+ @AfterEach
public final void tearDown() throws Exception {
if (window != null) {
spinEventLoop();
@@ -171,7 +167,7 @@ protected void sendKeyDownToControl(char character) {
Event event = new Event();
event.type = SWT.KeyDown;
event.character = character;
- assertTrue("unable to post event to display queue for test case", window.getDisplay().post(event));
+ assertTrue(window.getDisplay().post(event), "unable to post event to display queue for test case");
spinEventLoop();
}
@@ -186,7 +182,7 @@ protected void sendKeyDownToControl(KeyStroke keystroke) {
Event event = new Event();
event.type = SWT.KeyDown;
event.keyCode = keystroke.getNaturalKey();
- assertTrue("unable to post event to display queue for test case", window.getDisplay().post(event));
+ assertTrue(window.getDisplay().post(event), "unable to post event to display queue for test case");
spinEventLoop();
}
@@ -195,8 +191,7 @@ protected void sendKeyDownToControl(KeyStroke keystroke) {
*/
protected void assertOneShellUp() {
spinEventLoop();
- assertEquals("There should only be one shell up, the dialog", originalShellCount + 1,
- window.getDisplay().getShells().length);
+ assertEquals(originalShellCount + 1, window.getDisplay().getShells().length, "There should only be one shell up, the dialog");
}
/**
@@ -205,8 +200,7 @@ protected void assertOneShellUp() {
*/
protected void assertTwoShellsUp() {
spinEventLoop();
- assertEquals("There should two shells up, the dialog and the proposals dialog", originalShellCount + 2,
- window.getDisplay().getShells().length);
+ assertEquals(originalShellCount + 2, window.getDisplay().getShells().length, "There should two shells up, the dialog and the proposals dialog");
}
protected void setControlContent(String text) {
@@ -219,4 +213,4 @@ protected String getControlContent() {
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java
index d28a45f7067..a57ec3619a4 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java
@@ -13,9 +13,9 @@
*******************************************************************************/
package org.eclipse.jface.tests.fieldassist;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
@@ -27,16 +27,11 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.tests.harness.util.TestRunLogUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestWatcher;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ContentProposalAdapterTest {
- @Rule
- public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN;
/**
* A shell that hosts the decorated text control
@@ -121,7 +116,7 @@ public void testBug520372AutoActivationDelayESC() throws Exception {
// most of the following code is copied from AbstractFieldAssistTestCase
- @Before
+ @BeforeEach
public final void setUp() throws Exception {
Display display = getDisplay();
originalShellCount = display.getShells().length;
@@ -133,7 +128,7 @@ public final void setUp() throws Exception {
assertNotNull(contentProposalAdapter);
}
- @After
+ @AfterEach
public final void tearDown() throws Exception {
if (controlShell != null) {
spinEventLoop();
@@ -179,7 +174,7 @@ private void sendKeyDownToControl(char character) {
Event event = new Event();
event.type = SWT.KeyDown;
event.character = character;
- assertTrue("unable to post event to display queue for test case", text.getDisplay().post(event));
+ assertTrue(text.getDisplay().post(event), "unable to post event to display queue for test case");
spinEventLoop();
}
@@ -233,7 +228,6 @@ private void ensurePopupIsUp() {
*/
private void assertOneShellUp() {
spinEventLoop();
- assertEquals("There should only be one shell up, the dialog", originalShellCount + 1,
- text.getDisplay().getShells().length);
+ assertEquals(originalShellCount + 1, text.getDisplay().getShells().length, "There should only be one shell up, the dialog");
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java
index 5890ccfee8b..7bc70aff5ff 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java
@@ -13,16 +13,16 @@
******************************************************************************/
package org.eclipse.jface.tests.fieldassist;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
public class ControlDecorationTests extends AbstractFieldAssistTestCase {
@@ -37,15 +37,15 @@ public void testDecorationIsVisible() {
.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
decoration.setDescriptionText("foo");
window.open();
- assertTrue("1.0", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.0");
decoration.hide();
- assertFalse("1.1", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.1");
decoration.show();
- assertTrue("1.2", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.2");
window.getFieldAssistControl().setVisible(false);
- assertFalse("1.3", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.3");
window.getFieldAssistControl().setVisible(true);
- assertTrue("1.4", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.4");
// focus related tests. Comment out for now.
// see bug 275393
@@ -54,10 +54,10 @@ public void testDecorationIsVisible() {
spinEventLoop();
/*
- assertFalse("1.5", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.5");
window.getFieldAssistControl().setFocus();
spinEventLoop();
- assertTrue("1.6", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.6");
decoration.setShowOnlyOnFocus(false);
*/
@@ -71,7 +71,7 @@ public void testHoverVisibility() {
decoration.setImage(FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
decoration.setDescriptionText("foo");
- assertTrue("1.0", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.0");
assertOneShellUp();
decoration.hide();
decoration.showHoverText("Show me");
@@ -87,7 +87,7 @@ public void testHoverVisibility() {
// focus related tests
@Test
- @Ignore("Disabled see Bug 418420 and bug 275393")
+ @Disabled("Disabled see Bug 418420 and bug 275393")
public void testBug418420() {
AbstractFieldAssistWindow window = getFieldAssistWindow();
window.open();
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java
index bb2ea58a403..8a4e0a28469 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java
@@ -14,13 +14,13 @@
******************************************************************************/
package org.eclipse.jface.tests.fieldassist;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import org.eclipse.jface.fieldassist.ContentProposal;
import org.eclipse.jface.fieldassist.IContentProposal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FieldAssistAPITests extends AbstractFieldAssistTestCase {
@@ -32,45 +32,46 @@ public class FieldAssistAPITests extends AbstractFieldAssistTestCase {
@Test
public void testSimpleContentProposal() {
proposal = new ContentProposal(content);
- assertEquals("1.0", content, proposal.getContent());
- assertEquals("1.1", content, proposal.getLabel());
- assertNull("1.2", proposal.getDescription());
- assertEquals("1.3", content.length(), proposal.getCursorPosition());
+ assertEquals(content, proposal.getContent(), "1.0");
+ assertEquals(content, proposal.getLabel(), "1.1");
+ assertNull(proposal.getDescription(), "1.2");
+ assertEquals(content.length(), proposal.getCursorPosition(), "1.3");
}
@Test
public void testContentProposalWithCursor() {
proposal = new ContentProposal(content, label, description, 3);
- assertEquals("3.0", content, proposal.getContent());
- assertEquals("3.1", label, proposal.getLabel());
- assertEquals("3.2", description, proposal.getDescription());
- assertEquals("3.3", 3, proposal.getCursorPosition());
+ assertEquals(content, proposal.getContent(), "3.0");
+ assertEquals(label, proposal.getLabel(), "3.1");
+ assertEquals(description, proposal.getDescription(), "3.2");
+ assertEquals(3, proposal.getCursorPosition(), "3.3");
}
@Test
public void testContentProposalWithLabel() {
proposal = new ContentProposal(content, label, description);
- assertEquals("3.0", content, proposal.getContent());
- assertEquals("3.1", label, proposal.getLabel());
- assertEquals("3.2", description, proposal.getDescription());
- assertEquals("3.3", content.length(), proposal.getCursorPosition());
+ assertEquals(content, proposal.getContent(), "3.0");
+ assertEquals(label, proposal.getLabel(), "3.1");
+ assertEquals(description, proposal.getDescription(), "3.2");
+ assertEquals(content.length(), proposal.getCursorPosition(), "3.3");
}
@Test
public void testContentProposalWithDescription() {
proposal = new ContentProposal(content, description);
- assertEquals("2.0", content, proposal.getContent());
- assertEquals("2.1", content, proposal.getLabel());
- assertEquals("2.2", description, proposal.getDescription());
- assertEquals("2.3", content.length(), proposal.getCursorPosition());
+ assertEquals(content, proposal.getContent(), "2.0");
+ assertEquals(content, proposal.getLabel(), "2.1");
+ assertEquals(description, proposal.getDescription(), "2.2");
+ assertEquals(content.length(), proposal.getCursorPosition(), "2.3");
}
+ @Test
public void testInitializationWithInvalidCursor() {
try {
proposal = new ContentProposal(content, label, description, 100);
fail("4.0");
} catch (IllegalArgumentException e) {
- assertNull("It is expected to be null", proposal);
+ assertNull(proposal, "It is expected to be null");
}
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java
index fe259d49eda..f6862fda472 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java
@@ -13,9 +13,9 @@
******************************************************************************/
package org.eclipse.jface.tests.fieldassist;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
@@ -26,7 +26,7 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* This class contains test cases appropriate for generic field assist
@@ -104,7 +104,7 @@ public void testPropagateKeysOff() {
ensurePopupIsUp();
assertTwoShellsUp();
sendKeyDownToControl(EXTRA_CHAR);
- assertEquals("1.0", SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR}), getControlContent());
+ assertEquals(SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR}), getControlContent(), "1.0");
}
@Test
@@ -118,7 +118,7 @@ public void testPropagateKeysOn() {
ensurePopupIsUp();
assertTwoShellsUp();
sendKeyDownToControl(EXTRA_CHAR);
- assertEquals("1.0", SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR, EXTRA_CHAR}), getControlContent());
+ assertEquals(SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR, EXTRA_CHAR}), getControlContent(), "1.0");
}
@Test
@@ -169,28 +169,28 @@ public void testDecorationIsVisible() {
.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
decoration.setDescriptionText("foo");
spinEventLoop();
- assertTrue("1.0", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.0");
decoration.hide();
- assertFalse("1.1", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.1");
decoration.setShowOnlyOnFocus(true);
sendFocusElsewhere();
sendFocusInToControl();
spinEventLoop();
- assertFalse("1.2", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.2");
decoration.show();
- assertTrue("1.3", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.3");
sendFocusElsewhere();
spinEventLoop();
- assertFalse("1.4", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.4");
decoration.setShowOnlyOnFocus(false);
- assertTrue("1.5", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.5");
window.getFieldAssistControl().setVisible(false);
- assertFalse("1.6", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.6");
decoration.hide();
window.getFieldAssistControl().setVisible(true);
- assertFalse("1.7", decoration.isVisible());
+ assertFalse(decoration.isVisible(), "1.7");
decoration.show();
- assertTrue("1.8", decoration.isVisible());
+ assertTrue(decoration.isVisible(), "1.8");
}
@Test
@@ -206,16 +206,16 @@ public void testPopupFocus() {
// Send focus to the control (not the popup)
window.getFieldAssistControl().setFocus();
spinEventLoop();
- assertFalse("1.0", window.getContentProposalAdapter().hasProposalPopupFocus());
+ assertFalse(window.getContentProposalAdapter().hasProposalPopupFocus(), "1.0");
window.getContentProposalAdapter().setProposalPopupFocus();
spinEventLoop();
- assertTrue("1.1", window.getContentProposalAdapter().hasProposalPopupFocus());
+ assertTrue(window.getContentProposalAdapter().hasProposalPopupFocus(), "1.1");
// Setting focus to another shell deactivates the popup
sendFocusElsewhere();
spinEventLoop();
assertOneShellUp();
- assertFalse("1.2", window.getContentProposalAdapter().hasProposalPopupFocus());
+ assertFalse(window.getContentProposalAdapter().hasProposalPopupFocus(), "1.2");
}
@Test
@@ -226,16 +226,16 @@ public void testPopupIsOpen() {
window.setKeyStroke(stroke);
window.open();
- assertFalse("1.0", window.getContentProposalAdapter().isProposalPopupOpen());
+ assertFalse(window.getContentProposalAdapter().isProposalPopupOpen(), "1.0");
sendKeyDownToControl(stroke);
assertTwoShellsUp();
- assertTrue("1.1", window.getContentProposalAdapter().isProposalPopupOpen());
+ assertTrue(window.getContentProposalAdapter().isProposalPopupOpen(), "1.1");
// Setting focus to another shell deactivates the popup
sendFocusElsewhere();
spinEventLoop();
assertOneShellUp();
- assertFalse("1.2", window.getContentProposalAdapter().isProposalPopupOpen());
+ assertFalse(window.getContentProposalAdapter().isProposalPopupOpen(), "1.2");
}
/**
@@ -264,7 +264,7 @@ public void testBug256651ReplaceMode() {
Rectangle popupBounds = popupShell.getBounds();
Rectangle controlBounds = getFieldAssistWindow().getFieldAssistControl().getBounds();
controlBounds = getDisplay().map(getFieldAssistWindow().getFieldAssistControl().getParent(), null, controlBounds);
- assertFalse("Popup is blocking the control", popupBounds.intersects(controlBounds));
+ assertFalse(popupBounds.intersects(controlBounds), "Popup is blocking the control");
}
/**
@@ -292,6 +292,6 @@ public void testDefaultPopupPositioningReplaceMode() {
Rectangle popupBounds = popupShell.getBounds();
Rectangle controlBounds = getFieldAssistWindow().getFieldAssistControl().getBounds();
controlBounds = getDisplay().map(getFieldAssistWindow().getFieldAssistControl().getParent(), null, controlBounds);
- assertFalse("Popup is blocking the control", popupBounds.intersects(controlBounds));
+ assertFalse(popupBounds.intersects(controlBounds), "Popup is blocking the control");
}
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java
index 7761d2aa846..79bf25e2cdd 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java
@@ -14,8 +14,6 @@
*******************************************************************************/
package org.eclipse.jface.tests.images;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -24,7 +22,4 @@
UrlImageDescriptorTest.class, DecorationOverlayIconTest.class, DeferredImageDescriptorTest.class })
public class AllImagesTests {
- public static void main(String[] args) {
- JUnitCore.main(AllImagesTests.class.getName());
- }
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java
index 8300fa57ddc..31ef2696927 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java
@@ -15,15 +15,16 @@
******************************************************************************/
package org.eclipse.jface.tests.images;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
-import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
@@ -32,14 +33,13 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageFileNameProvider;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
public class UrlImageDescriptorTest {
- @Rule
- public TemporaryFolder tempFolder = new TemporaryFolder();
+ @TempDir
+ public Path tempFolder;
/**
* Test that individually created images of a given descriptor are not equal
@@ -50,10 +50,10 @@ public void testDifferentImagesPerUrlImageDescriptor() {
ImageDescriptor descriptor = ImageDescriptor
.createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/anything.gif"));
Image image1 = descriptor.createImage();
- assertNotNull("Could not find first image", image1);
+ assertNotNull(image1, "Could not find first image");
Image image2 = descriptor.createImage();
- assertNotNull("Could not find second image", image2);
- assertNotEquals("Found equal images for URLImageDescriptor", image1, image2);
+ assertNotNull(image2, "Could not find second image");
+ assertNotEquals(image1, image2, "Found equal images for URLImageDescriptor");
image1.dispose();
image2.dispose();
}
@@ -86,23 +86,22 @@ public void testImageFileNameProviderGetxPath() {
.createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/rectangular-57x16.png"));
ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class);
- assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider);
+ assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider");
ImageFileNameProvider fileNameProvider2nd = Adapters.adapt(descriptor, ImageFileNameProvider.class);
// Issue #679: The returned ImageFileNameProvider must be different each time,
// because Image#equals depends on this non-uniqueness:
- assertNotSame("URLImageDescriptor does return identical ImageFileNameProvider", fileNameProvider,
- fileNameProvider2nd);
+ assertNotSame(fileNameProvider, fileNameProvider2nd, "URLImageDescriptor does return identical ImageFileNameProvider");
String imagePath100 = fileNameProvider.getImagePath(100);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100);
- assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "rectangular-57x16.png");
+ assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path");
+ assertEquals("rectangular-57x16.png", IPath.fromOSString(imagePath100).lastSegment());
String imagePath200 = fileNameProvider.getImagePath(200);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 200% path", imagePath200);
- assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "rectangular-114x32.png");
+ assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the 200% path");
+ assertEquals("rectangular-114x32.png", IPath.fromOSString(imagePath200).lastSegment());
String imagePath150 = fileNameProvider.getImagePath(150);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 150% path", imagePath150);
- assertEquals(IPath.fromOSString(imagePath150).lastSegment(), "rectangular-86x24.png");
+ assertNotNull(imagePath150, "URLImageDescriptor ImageFileNameProvider does not return the 150% path");
+ assertEquals("rectangular-86x24.png", IPath.fromOSString(imagePath150).lastSegment());
String imagePath250 = fileNameProvider.getImagePath(250);
- assertNull("URLImageDescriptor's ImageFileNameProvider does return a 250% path", imagePath250);
+ assertNull(imagePath250, "URLImageDescriptor's ImageFileNameProvider does return a 250% path");
}
@Test
@@ -111,15 +110,15 @@ public void testImageFileNameProviderGetxName() {
.createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/zoomIn.png"));
ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class);
- assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider);
+ assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider");
String imagePath100 = fileNameProvider.getImagePath(100);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100);
- assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "zoomIn.png");
+ assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path");
+ assertEquals("zoomIn.png", IPath.fromOSString(imagePath100).lastSegment());
String imagePath200 = fileNameProvider.getImagePath(200);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the @2x path", imagePath200);
- assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "zoomIn@2x.png");
+ assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the @2x path");
+ assertEquals("zoomIn@2x.png", IPath.fromOSString(imagePath200).lastSegment());
String imagePath150 = fileNameProvider.getImagePath(150);
- assertNull("URLImageDescriptor's ImageFileNameProvider does return a @1.5x path", imagePath150);
+ assertNull(imagePath150, "URLImageDescriptor's ImageFileNameProvider does return a @1.5x path");
}
@Test
@@ -136,20 +135,22 @@ private void testImageFileNameProviderGetxName_forFileURL(boolean osgiAvailable)
boolean oldOsgiAvailable = InternalPolicy.OSGI_AVAILABLE;
InternalPolicy.OSGI_AVAILABLE = osgiAvailable;
try {
- URL imageFileURL = tempFolder.newFile("image.png").toURI().toURL();
- tempFolder.newFile("image@2x.png");
+ Path imagePath = tempFolder.resolve("image.png");
+ Files.createFile(imagePath);
+ URL imageFileURL = imagePath.toUri().toURL();
+ Files.createFile(tempFolder.resolve("image@2x.png"));
ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageFileURL);
ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class);
- assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider);
+ assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider");
String imagePath100 = fileNameProvider.getImagePath(100);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100);
- assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "image.png");
+ assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path");
+ assertEquals("image.png", IPath.fromOSString(imagePath100).lastSegment());
String imagePath200 = fileNameProvider.getImagePath(200);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the @2x path", imagePath200);
- assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "image@2x.png");
+ assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the @2x path");
+ assertEquals("image@2x.png", IPath.fromOSString(imagePath200).lastSegment());
String imagePath150 = fileNameProvider.getImagePath(150);
- assertNull("URLImageDescriptor's ImageFileNameProvider does return a @1.5x path", imagePath150);
+ assertNull(imagePath150, "URLImageDescriptor's ImageFileNameProvider does return a @1.5x path");
} finally {
InternalPolicy.OSGI_AVAILABLE = oldOsgiAvailable;
}
@@ -157,21 +158,22 @@ private void testImageFileNameProviderGetxName_forFileURL(boolean osgiAvailable)
@Test
public void testImageFileNameProviderGetxName_forFileURL_WhiteSpace() throws IOException {
- File imageFolder = tempFolder.newFolder("folder with spaces");
- File imageFile = new File(imageFolder, "image with spaces.png");
- imageFile.createNewFile();
+ Path imageFolder = tempFolder.resolve("folder with spaces");
+ Files.createDirectories(imageFolder);
+ Path imagePath = imageFolder.resolve("image with spaces.png");
+ Files.createFile(imagePath);
// This is an invalid URL because the whitespace characters are not properly
// encoded
@SuppressWarnings("deprecation")
- URL imageFileURL = new URL("file", null, imageFile.getPath());
+ URL imageFileURL = new URL("file", null, imagePath.toString());
ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageFileURL);
ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class);
- assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider);
+ assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider");
String imagePath100 = fileNameProvider.getImagePath(100);
- assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100);
+ assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path");
}
@Test
@@ -180,24 +182,24 @@ public void testAdaptToURL() {
.createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/rectangular-57x16.png"));
URL url = Adapters.adapt(descriptor, URL.class);
- assertNotNull("URLImageDescriptor does not adapt to URL", url);
+ assertNotNull(url, "URLImageDescriptor does not adapt to URL");
ImageDescriptor descriptorFromUrl = ImageDescriptor.createFromURL(url);
ImageData imageDataOrig = descriptor.getImageData(100);
- assertNotNull("Original URL does not return 100% image data", imageDataOrig);
+ assertNotNull(imageDataOrig, "Original URL does not return 100% image data");
ImageData imageDataURL = descriptorFromUrl.getImageData(100);
- assertNotNull("Adapted URL does not return 100% image data", imageDataURL);
+ assertNotNull(imageDataURL, "Adapted URL does not return 100% image data");
assertEquals(imageDataOrig.width, imageDataURL.width);
assertEquals(imageDataOrig.height, imageDataURL.height);
ImageData imageDataOrig200 = descriptor.getImageData(200);
- assertNotNull("Original URL does not return 200% image data", imageDataOrig200);
+ assertNotNull(imageDataOrig200, "Original URL does not return 200% image data");
ImageData imageDataURL200 = descriptorFromUrl.getImageData(200);
assertEquals(imageDataOrig200.width, imageDataURL200.width);
assertEquals(imageDataOrig200.height, imageDataURL200.height);
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java
index d61447c8555..20683ad36b9 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java
@@ -13,8 +13,6 @@
*******************************************************************************/
package org.eclipse.jface.tests.layout;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -23,8 +21,4 @@
GridLayoutFactoryTest.class, TreeColumnLayoutTest.class })
public class AllLayoutTests {
- public static void main(String[] args) {
- JUnitCore.main(AllLayoutTests.class.getName());
- }
-
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java
index 18f658a8121..770e8dae7f8 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java
@@ -13,8 +13,6 @@
*******************************************************************************/
package org.eclipse.jface.tests.preferences;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -27,7 +25,4 @@
})
public class AllPrefsTests {
- public static void main(String[] args) {
- JUnitCore.main(AllPrefsTests.class.getName());
- }
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java
index 9f29e3c86a0..c43ef85ded5 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java
@@ -14,8 +14,6 @@
package org.eclipse.jface.tests.resources;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -23,7 +21,4 @@
@SelectClasses({ FontRegistryTest.class, JFaceResourcesTest.class })
public class AllResourcesTests {
- public static void main(String[] args) {
- JUnitCore.main(AllResourcesTests.class.getName());
- }
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java
index 977fe3297eb..f817e28c8ab 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java
@@ -18,7 +18,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.time.Duration;
import java.time.Instant;
@@ -55,7 +55,7 @@ public void testBug544026() {
@Test
public void multipleDisplayDispose() {
- assumeTrue("multiple Display instance only allowed on Windows", OS.isWindows());
+ assumeTrue(OS.isWindows(), "multiple Display instance only allowed on Windows");
FontRegistry fontRegistry = new FontRegistry();
Display secondDisplay = initializeDisplayInSeparateThread();
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java
index 5b6d9f7da94..b3f91db75f0 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java
@@ -13,8 +13,6 @@
*******************************************************************************/
package org.eclipse.jface.tests.viewers;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -36,8 +34,4 @@
TableViewerWithLimitCompatibilityTest.class })
public class AllViewersTests {
- public static void main(String[] args) {
- JUnitCore.main(AllViewersTests.class.getName());
- }
-
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java
index 9ee269ced36..a01b5642b60 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java
@@ -18,8 +18,6 @@
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
-import junit.framework.AssertionFailedError;
-
/**
* The TestLazyModelContentProvider is the lazy version
* of the model content provider.
@@ -32,7 +30,7 @@ public class TestLazyModelContentProvider extends TestModelContentProvider imple
TestLazyModelContentProvider(TableViewerTest testObject){
test = testObject;
if(!(testObject instanceof VirtualLazyTableViewerTest)) {
- throw new AssertionFailedError("TestLazyModelContentProvider only works with VirtualLazyTableViewerTest");
+ throw new IllegalStateException("TestLazyModelContentProvider only works with VirtualLazyTableViewerTest");
}
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java
index 15d34fb2b45..55024b649e8 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java
@@ -14,10 +14,10 @@
package org.eclipse.jface.tests.viewers;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.List;
@@ -50,17 +50,17 @@ private void assertSetSelectionExpNode(DataModel invisible) {
treeViewer.setSelection(new StructuredSelection(invisible), true);
processEvents();
IStructuredSelection selection = treeViewer.getStructuredSelection();
- assertFalse("Selection must not be empty", selection.isEmpty());
+ assertFalse(selection.isEmpty(), "Selection must not be empty");
Object firstElement = selection.getFirstElement();
- assertTrue("Selection must be expandable node: " + firstElement, treeViewer.isExpandableNode(firstElement));
+ assertTrue(treeViewer.isExpandableNode(firstElement), "Selection must be expandable node: " + firstElement);
}
private void assertSetSelection(DataModel firstEle) {
treeViewer.setSelection(new StructuredSelection(firstEle));
processEvents();
IStructuredSelection selection = treeViewer.getStructuredSelection();
- assertFalse("Selection must not be empty", selection.isEmpty());
- assertEquals("incorrect element is selected", firstEle, selection.getFirstElement());
+ assertFalse(selection.isEmpty(), "Selection must not be empty");
+ assertEquals(firstEle, selection.getFirstElement(), "incorrect element is selected");
}
@Test
@@ -85,7 +85,7 @@ public void testReveal() throws Exception {
break;
}
}
- assertTrue("item to select must be inside expandable node", found);
+ assertTrue(found, "item to select must be inside expandable node");
}
@Test
@@ -100,7 +100,7 @@ public void testCollapseAll() {
TreeItem[] items = assertLimitedItems();
for (int i = 0; i < VIEWER_LIMIT; i++) {
TreeItem treeItem = items[i];
- assertFalse("expansion must be false", treeItem.getExpanded());
+ assertFalse(treeItem.getExpanded(), "expansion must be false");
}
}
@@ -124,17 +124,17 @@ public void testExpandAll() {
private TreeItem[] assertLimitedItems(TreeItem treeItem) {
TreeItem[] items = treeItem.getItems();
- assertEquals("There should be only limited items", VIEWER_LIMIT + 1, items.length);
+ assertEquals(VIEWER_LIMIT + 1, items.length, "There should be only limited items");
Object data = items[VIEWER_LIMIT].getData();
- assertTrue("last item must be expandable node", treeViewer.isExpandableNode(data));
+ assertTrue(treeViewer.isExpandableNode(data), "last item must be expandable node");
return items;
}
private TreeItem[] assertLimitedItems() {
TreeItem[] rootLevelItems = treeViewer.getTree().getItems();
- assertEquals("There should be only limited items", VIEWER_LIMIT + 1, rootLevelItems.length);
+ assertEquals(VIEWER_LIMIT + 1, rootLevelItems.length, "There should be only limited items");
Object data = rootLevelItems[VIEWER_LIMIT].getData();
- assertTrue("last item must be expandable node", treeViewer.isExpandableNode(data));
+ assertTrue(treeViewer.isExpandableNode(data), "last item must be expandable node");
return rootLevelItems;
}
@@ -153,8 +153,8 @@ public void testExpandToLevelInt() {
private static void assertDummyItem(TreeItem treeItem) {
TreeItem[] items = treeItem.getItems();
- assertEquals("Item must not be expanded", 1, items.length);
- assertNull("Dummy tree item data must be null", items[0].getData());
+ assertEquals(1, items.length, "Item must not be expanded");
+ assertNull(items[0].getData(), "Dummy tree item data must be null");
}
@Test
@@ -181,12 +181,12 @@ public void testRemoveItemsAtParent() {
DataModel firstEle = rootModel.get(0);
DataModel thirdOfFirst = firstEle.children.get(2).children.remove(2);
TreeItem visItem = treeViewer.getTree().getItem(0).getItem(2).getItem(2);
- assertEquals("element contains unexpected data", thirdOfFirst, visItem.getData());
+ assertEquals(thirdOfFirst, visItem.getData(), "element contains unexpected data");
treeViewer.remove(firstEle, new Object[] { thirdOfFirst });
processEvents();
thirdOfFirst = firstEle.children.get(2).children.get(2);
visItem = treeViewer.getTree().getItem(0).getItem(2).getItem(2);
- assertEquals("element contains unexpected data", thirdOfFirst, visItem.getData());
+ assertEquals(thirdOfFirst, visItem.getData(), "element contains unexpected data");
}
@Test
@@ -196,12 +196,12 @@ public void testRemoveItem() {
processEvents();
DataModel firstEle = rootModel.remove(0);
TreeItem firstItem = treeViewer.getTree().getItem(0);
- assertEquals("element contains unexpected data", firstEle, firstItem.getData());
+ assertEquals(firstEle, firstItem.getData(), "element contains unexpected data");
treeViewer.remove(firstEle);
processEvents();
firstEle = rootModel.get(0);
firstItem = treeViewer.getTree().getItem(0);
- assertEquals("element contains unexpected data", firstEle, firstItem.getData());
+ assertEquals(firstEle, firstItem.getData(), "element contains unexpected data");
}
@Test
@@ -222,37 +222,37 @@ public void testSetAutoExpandLevel() {
@Test
public void testInsert() {
TreeItem thirdItem = treeViewer.getTree().getItem(2);
- assertEquals("unexpected element found at position 2", rootModel.get(2), thirdItem.getData());
+ assertEquals(rootModel.get(2), thirdItem.getData(), "unexpected element found at position 2");
DataModel newElement = new DataModel(Integer.valueOf(3));
rootModel.add(newElement);
treeViewer.insert(rootModel, newElement, 2);
processEvents();
thirdItem = treeViewer.getTree().getItem(2);
- assertEquals("unexpected element found at position 2", newElement, thirdItem.getData());
+ assertEquals(newElement, thirdItem.getData(), "unexpected element found at position 2");
}
@Test
public void testRefresh() {
DataModel firstEle = rootModel.remove(0);
TreeItem firstItem = treeViewer.getTree().getItem(0);
- assertEquals("element contains unexpected data", firstEle, firstItem.getData());
+ assertEquals(firstEle, firstItem.getData(), "element contains unexpected data");
treeViewer.refresh();
processEvents();
firstEle = rootModel.get(0);
firstItem = treeViewer.getTree().getItem(0);
- assertEquals("element contains unexpected data", firstEle, firstItem.getData());
+ assertEquals(firstEle, firstItem.getData(), "element contains unexpected data");
}
@Test
public void testSetFilters() {
DataModel firstEle = rootModel.get(0);
TreeItem firstItem = treeViewer.getTree().getItem(0);
- assertEquals("element contains unexpected data", firstEle, firstItem.getData());
+ assertEquals(firstEle, firstItem.getData(), "element contains unexpected data");
treeViewer.setFilters(new TestViewerFilter());
processEvents();
firstEle = rootModel.get(6);
firstItem = treeViewer.getTree().getItem(0);
- assertEquals("element contains unexpected data", firstEle, firstItem.getData());
+ assertEquals(firstEle, firstItem.getData(), "element contains unexpected data");
}
@Test
@@ -262,7 +262,7 @@ public void testSetInput() {
rootModel.add(rootLevel);
treeViewer.setInput(rootModel);
processEvents();
- assertEquals("there must be only one item", 1, treeViewer.getTree().getItems().length);
+ assertEquals(1, treeViewer.getTree().getItems().length, "there must be only one item");
treeViewer.setInput(createModel(DEFAULT_ELEMENTS_COUNT));
processEvents();
assertLimitedItems();
@@ -271,21 +271,18 @@ public void testSetInput() {
@Test
public void testContains() {
// some random element.
- assertFalse("element must not be available on the viewer", treeViewer.contains(fRootElement, ""));
+ assertFalse(treeViewer.contains(fRootElement, ""), "element must not be available on the viewer");
// first child of root.
- assertTrue("element must be available on the viewer", treeViewer.contains(rootModel, rootModel.get(0)));
+ assertTrue(treeViewer.contains(rootModel, rootModel.get(0)), "element must be available on the viewer");
// last child of the root
- assertTrue("element must be available on the viewer",
- treeViewer.contains(rootModel, rootModel.get(rootModel.size() - 1)));
+ assertTrue(treeViewer.contains(rootModel, rootModel.get(rootModel.size() - 1)), "element must be available on the viewer");
// child of first element is not expanded
- assertFalse("element must not be available on the viewer",
- treeViewer.contains(rootModel, rootModel.get(0).children.get(0)));
+ assertFalse(treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must not be available on the viewer");
treeViewer.expandAll();
// child of first element when expanded.
- assertTrue("element must be available on the viewer",
- treeViewer.contains(rootModel, rootModel.get(0).children.get(0)));
+ assertTrue(treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must be available on the viewer");
}
@Override
@@ -346,4 +343,4 @@ public TestTreeViewer(Composite parent) {
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java
index 55e74f7b7af..7fc03b35e5e 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java
@@ -14,8 +14,6 @@
package org.eclipse.jface.tests.window;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -26,7 +24,4 @@
})
public class AllWindowTests {
- public static void main(String[] args) {
- JUnitCore.main(AllWindowTests.class.getName());
- }
}
diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java
index b8154f28091..1ebd2c13d99 100644
--- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java
+++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java
@@ -14,8 +14,6 @@
package org.eclipse.jface.tests.wizards;
-import org.junit.runner.JUnitCore;
-
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@@ -23,8 +21,4 @@
@SelectClasses({ ButtonAlignmentTest.class, WizardTest.class, WizardProgressMonitorTest.class })
public class WizardTestSuite {
- public static void main(String[] args) {
- JUnitCore.main(WizardTestSuite.class.getName());
- }
-
}
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF
index 84e9f71799e..62fe594fdf3 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.ltk.core.refactoring.tests
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ltk.core.refactoring.tests; singleton:=true
-Bundle-Version: 3.10.700.qualifier
+Bundle-Version: 3.10.800.qualifier
Bundle-Activator: org.eclipse.ltk.core.refactoring.tests.RefactoringCoreTestPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java
index a352f09cd95..200a22dead3 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java
@@ -13,11 +13,11 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java
index 62181b4dd0d..26cad529e70 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java
@@ -10,11 +10,11 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- *******************************************************************************/
+ ******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.history;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -24,7 +24,7 @@
import java.util.List;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.runtime.CoreException;
@@ -62,20 +62,20 @@ public int read(byte[] b) throws IOException {
RefactoringHistory result= RefactoringCore.getHistoryService().readRefactoringHistory(stream, flags);
RefactoringDescriptorProxy[] actualProxies= result.getDescriptors();
RefactoringDescriptorProxy[] expectedProxies= list.toArray(new RefactoringDescriptorProxy[list.size()]);
- assertEquals("The number of refactoring descriptors is incorrect.", expectedProxies.length, actualProxies.length);
+ assertEquals(expectedProxies.length, actualProxies.length, "The number of refactoring descriptors is incorrect.");
for (int index= 0; index < expectedProxies.length; index++) {
RefactoringDescriptor expectedDescriptor= expectedProxies[index].requestDescriptor(null);
- assertNotNull("Expected refactoring descriptor cannot be resolved.", expectedDescriptor);
+ assertNotNull(expectedDescriptor, "Expected refactoring descriptor cannot be resolved.");
RefactoringDescriptor actualDescriptor= actualProxies[index].requestDescriptor(null);
- assertNotNull("Actual refactoring descriptor cannot be resolved.", actualDescriptor);
- assertEquals("Expected refactoring descriptor is not equal to actual one:", expectedDescriptor.toString(), actualDescriptor.toString());
+ assertNotNull(actualDescriptor, "Actual refactoring descriptor cannot be resolved.");
+ assertEquals(expectedDescriptor.toString(), actualDescriptor.toString(), "Expected refactoring descriptor is not equal to actual one:");
}
}
private static void compareWrittenDescriptor(RefactoringSessionDescriptor descriptor, boolean time, String xml) throws CoreException {
ByteArrayOutputStream stream= new ByteArrayOutputStream();
RefactoringCore.getHistoryService().writeRefactoringSession(descriptor, stream, time);
- assertEquals("The refactoring descriptor has not been correctly serialized:", convertLineDelimiters(xml), stream.toString(StandardCharsets.UTF_8));
+ assertEquals(convertLineDelimiters(xml), stream.toString(StandardCharsets.UTF_8), "The refactoring descriptor has not been correctly serialized:");
}
private static String concatenate(String[] lines, String delimiter) {
@@ -107,15 +107,24 @@ private static String[] convertIntoLines(String input) {
private static String convertLineDelimiters(String xml) {
String delimiter= System.lineSeparator();
- assertNotNull("Could not determine line separator.", delimiter);
+ assertNotNull(delimiter, "Could not determine line separator.");
if (!"\n".equals(delimiter))
xml= concatenate(convertIntoLines(xml), delimiter);
+ // Trim the trailing newline if the xml string has one (Text Blocks usually add one)
+ // But here we might want to keep it if original tests expected it?
+ // Original tests: "...\n" + "";
+ // So they ended with \n.
return xml;
}
@Test
public void testReadDescriptor0() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+ """;
int flags= RefactoringDescriptor.NONE;
MockRefactoringDescriptor descriptor= new MockRefactoringDescriptor("test0", "A mock refactoring", "A mock comment", RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.BREAKING_CHANGE);
Map arguments= descriptor.getArguments();
@@ -127,7 +136,12 @@ public void testReadDescriptor0() throws Exception {
@Test
public void testReadDescriptor1() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+ """;
int flags= RefactoringDescriptor.NONE;
MockRefactoringDescriptor descriptor= new MockRefactoringDescriptor("test1", "A mock refactoring", "A mock comment", RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= descriptor.getArguments();
@@ -139,7 +153,14 @@ public void testReadDescriptor1() throws Exception {
@Test
public void testReadDescriptor10() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.MULTI_CHANGE;
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= third.getArguments();
@@ -148,13 +169,20 @@ public void testReadDescriptor10() throws Exception {
try {
compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, true);
} catch (CoreException exception) {
- assertEquals("Wrong status code for refactoring history io error:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history io error:");
}
}
@Test
public void testReadDescriptor11() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.MULTI_CHANGE;
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= third.getArguments();
@@ -163,13 +191,20 @@ public void testReadDescriptor11() throws Exception {
try {
compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false);
} catch (CoreException exception) {
- assertEquals("Wrong status code for refactoring history io error:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history io error:");
}
}
@Test
public void testReadDescriptor12() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.MULTI_CHANGE;
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= third.getArguments();
@@ -178,13 +213,18 @@ public void testReadDescriptor12() throws Exception {
try {
compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, true);
} catch (CoreException exception) {
- assertEquals("Wrong status code for refactoring history io error:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history io error:");
}
}
@Test
public void testReadDescriptor2() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+ """;
int flags= RefactoringDescriptor.NONE;
MockRefactoringDescriptor descriptor= new MockRefactoringDescriptor(null, "A mock refactoring", "A mock comment", RefactoringDescriptor.NONE);
Map arguments= descriptor.getArguments();
@@ -194,7 +234,13 @@ public void testReadDescriptor2() throws Exception {
@Test
public void testReadDescriptor3() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.NONE;
MockRefactoringDescriptor first= new MockRefactoringDescriptor(null, "A mock refactoring", "A mock comment", RefactoringDescriptor.NONE);
MockRefactoringDescriptor second= new MockRefactoringDescriptor(null, "Another mock refactoring", "No comment", RefactoringDescriptor.BREAKING_CHANGE);
@@ -207,7 +253,14 @@ public void testReadDescriptor3() throws Exception {
@Test
public void testReadDescriptor4() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.NONE;
MockRefactoringDescriptor first= new MockRefactoringDescriptor(null, "A mock refactoring", "A mock comment", RefactoringDescriptor.NONE);
MockRefactoringDescriptor second= new MockRefactoringDescriptor(null, "Another mock refactoring", "No comment", RefactoringDescriptor.BREAKING_CHANGE);
@@ -225,7 +278,14 @@ public void testReadDescriptor4() throws Exception {
@Test
public void testReadDescriptor5() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.BREAKING_CHANGE;
MockRefactoringDescriptor second= new MockRefactoringDescriptor(null, "Another mock refactoring", "No comment", RefactoringDescriptor.BREAKING_CHANGE);
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
@@ -240,7 +300,14 @@ public void testReadDescriptor5() throws Exception {
@Test
public void testReadDescriptor6() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.MULTI_CHANGE;
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= third.getArguments();
@@ -251,7 +318,14 @@ public void testReadDescriptor6() throws Exception {
@Test
public void testReadDescriptor7() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.MULTI_CHANGE;
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= third.getArguments();
@@ -260,13 +334,20 @@ public void testReadDescriptor7() throws Exception {
try {
compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false);
} catch (CoreException exception) {
- assertEquals("Wrong status code for unsupported refactoring history version exception:", IRefactoringCoreStatusCodes.UNSUPPORTED_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.UNSUPPORTED_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode(), "Wrong status code for unsupported refactoring history version exception:");
}
}
@Test
public void testReadDescriptor8() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.MULTI_CHANGE;
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= third.getArguments();
@@ -275,13 +356,20 @@ public void testReadDescriptor8() throws Exception {
try {
compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false);
} catch (CoreException exception) {
- assertEquals("Wrong status code for missing refactoring history version exception:", IRefactoringCoreStatusCodes.MISSING_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.MISSING_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode(), "Wrong status code for missing refactoring history version exception:");
}
}
@Test
public void testReadDescriptor9() throws Exception {
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "";
+ String xml= """
+
+
+
+
+
+
+ """;
int flags= RefactoringDescriptor.MULTI_CHANGE;
MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
Map arguments= third.getArguments();
@@ -290,7 +378,7 @@ public void testReadDescriptor9() throws Exception {
try {
compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false);
} catch (CoreException exception) {
- assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:");
}
}
@@ -304,7 +392,11 @@ public void testWriteDescriptor0() throws Exception {
String version= "1.0";
String comment= "A mock comment";
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { descriptor}, version, comment);
- String xml= "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+ """;
compareWrittenDescriptor(session, true, xml);
}
@@ -318,7 +410,11 @@ public void testWriteDescriptor1() throws Exception {
String version= "2.0";
String comment= "A mock comment";
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { descriptor}, version, comment);
- String xml= "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+ """;
compareWrittenDescriptor(session, true, xml);
}
@@ -330,7 +426,11 @@ public void testWriteDescriptor2() throws Exception {
String version= "2.0";
String comment= null;
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { descriptor}, version, comment);
- String xml= "\n" + "\n" + "\n" + "" ;
+ String xml= """
+
+
+
+ """;
compareWrittenDescriptor(session, true, xml);
}
@@ -345,7 +445,12 @@ public void testWriteDescriptor3() throws Exception {
String version= "1.0";
String comment= null;
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second}, version, comment);
- String xml= "\n" + "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+
+ """;
compareWrittenDescriptor(session, false, xml);
}
@@ -365,7 +470,13 @@ public void testWriteDescriptor4() throws Exception {
String version= "3.0";
String comment= null;
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment);
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+
+
+ """;
compareWrittenDescriptor(session, true, xml);
}
@@ -385,11 +496,17 @@ public void testWriteDescriptor5() throws Exception {
String version= "3.0";
String comment= null;
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment);
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+
+
+ """;
try {
compareWrittenDescriptor(session, true, xml);
} catch (CoreException exception) {
- assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:");
}
}
@@ -409,11 +526,17 @@ public void testWriteDescriptor6() throws Exception {
String version= "3.0";
String comment= null;
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment);
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+
+
+ """;
try {
compareWrittenDescriptor(session, true, xml);
} catch (CoreException exception) {
- assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:");
}
}
@@ -433,11 +556,17 @@ public void testWriteDescriptor7() throws Exception {
String version= "3.0";
String comment= null;
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment);
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+
+
+ """;
try {
compareWrittenDescriptor(session, true, xml);
} catch (CoreException exception) {
- assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode());
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:");
}
}
@@ -457,8 +586,14 @@ public void testWriteDescriptor8() throws Exception {
String version= "3.0";
String comment= null;
RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment);
- String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + "";
+ String xml= """
+
+
+
+
+
+ """;
compareWrittenDescriptor(session, true, xml);
}
-}
\ No newline at end of file
+}
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java
index 086030d37ea..656da86a562 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java
@@ -13,21 +13,21 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.history;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.osgi.service.prefs.BackingStoreException;
import org.eclipse.core.runtime.CoreException;
@@ -60,24 +60,24 @@ private static final class RefactoringExecutionListener implements IRefactoringE
private RefactoringExecutionEvent fLastEvent= null;
public void assertEventDescriptor(RefactoringDescriptorProxyAdapter expected) throws Exception {
- assertNotNull("No refactoring history event has been recorded", fLastEvent);
+ assertNotNull(fLastEvent, "No refactoring history event has been recorded");
RefactoringDescriptor expectedDescriptor= expected.requestDescriptor(null);
- assertNotNull("Could not resolve expected refactoring descriptor", expectedDescriptor);
+ assertNotNull(expectedDescriptor, "Could not resolve expected refactoring descriptor");
expectedDescriptor.setTimeStamp(fLastEvent.getDescriptor().getTimeStamp());
- assertEquals("Wrong refactoring descriptor proxy in refactoring history event:", expected, fLastEvent.getDescriptor());
+ assertEquals(expected, fLastEvent.getDescriptor(), "Wrong refactoring descriptor proxy in refactoring history event:");
RefactoringDescriptor actualDescriptor= fLastEvent.getDescriptor().requestDescriptor(null);
- assertNotNull("Could not resolve actual refactoring descriptor", actualDescriptor);
- assertEquals("Resolved refactoring descriptors are not equal:", expectedDescriptor, actualDescriptor);
+ assertNotNull(actualDescriptor, "Could not resolve actual refactoring descriptor");
+ assertEquals(expectedDescriptor, actualDescriptor, "Resolved refactoring descriptors are not equal:");
}
public void assertEventSource(IRefactoringHistoryService expected) throws Exception {
- assertNotNull("No refactoring history event has been recorded", fLastEvent);
- assertSame("Wrong refactoring history service in refactoring history event:", expected, fLastEvent.getHistoryService());
+ assertNotNull(fLastEvent, "No refactoring history event has been recorded");
+ assertSame(expected, fLastEvent.getHistoryService(), "Wrong refactoring history service in refactoring history event:");
}
public void assertEventType(int expected) throws Exception {
- assertNotNull("No refactoring history event has been recorded", fLastEvent);
- assertEquals("Wrong refactoring history event type:", expected, fLastEvent.getEventType());
+ assertNotNull(fLastEvent, "No refactoring history event has been recorded");
+ assertEquals(expected, fLastEvent.getEventType(), "Wrong refactoring history event type:");
}
public void connect() {
@@ -96,13 +96,13 @@ public void executionNotification(RefactoringExecutionEvent event) {
int previous= fLastEvent != null ? fLastEvent.getEventType() : -1;
switch (event.getEventType()) {
case RefactoringExecutionEvent.PERFORMED:
- assertEquals("Previous event should be ABOUT_TO_PERFORM", RefactoringExecutionEvent.ABOUT_TO_PERFORM, previous);
+ assertEquals(RefactoringExecutionEvent.ABOUT_TO_PERFORM, previous, "Previous event should be ABOUT_TO_PERFORM");
break;
case RefactoringExecutionEvent.REDONE:
- assertEquals("Previous event should be ABOUT_TO_REDO", RefactoringExecutionEvent.ABOUT_TO_REDO, previous);
+ assertEquals(RefactoringExecutionEvent.ABOUT_TO_REDO, previous, "Previous event should be ABOUT_TO_REDO");
break;
case RefactoringExecutionEvent.UNDONE:
- assertEquals("Previous event should be ABOUT_TO_UNDO", RefactoringExecutionEvent.ABOUT_TO_UNDO, previous);
+ assertEquals(RefactoringExecutionEvent.ABOUT_TO_UNDO, previous, "Previous event should be ABOUT_TO_UNDO");
break;
}
fLastEvent= event;
@@ -114,24 +114,24 @@ private static final class RefactoringHistoryListener implements IRefactoringHis
private RefactoringHistoryEvent fLastEvent= null;
public void assertEventDescriptor(RefactoringDescriptorProxyAdapter expected) throws Exception {
- assertNotNull("No refactoring history event has been recorded", fLastEvent);
+ assertNotNull(fLastEvent, "No refactoring history event has been recorded");
RefactoringDescriptor expectedDescriptor= expected.requestDescriptor(null);
- assertNotNull("Could not resolve expected refactoring descriptor", expectedDescriptor);
+ assertNotNull(expectedDescriptor, "Could not resolve expected refactoring descriptor");
expectedDescriptor.setTimeStamp(fLastEvent.getDescriptor().getTimeStamp());
- assertEquals("Wrong refactoring descriptor proxy in refactoring history event:", expected, fLastEvent.getDescriptor());
+ assertEquals(expected, fLastEvent.getDescriptor(), "Wrong refactoring descriptor proxy in refactoring history event:");
RefactoringDescriptor actualDescriptor= fLastEvent.getDescriptor().requestDescriptor(null);
- assertNotNull("Could not resolve actual refactoring descriptor", actualDescriptor);
- assertEquals("Resolved refactoring descriptors are not equal:", expectedDescriptor, actualDescriptor);
+ assertNotNull(actualDescriptor, "Could not resolve actual refactoring descriptor");
+ assertEquals(expectedDescriptor, actualDescriptor, "Resolved refactoring descriptors are not equal:");
}
public void assertEventSource(IRefactoringHistoryService expected) throws Exception {
- assertNotNull("No refactoring history event has been recorded", fLastEvent);
- assertSame("Wrong refactoring history service in refactoring history event:", expected, fLastEvent.getHistoryService());
+ assertNotNull(fLastEvent, "No refactoring history event has been recorded");
+ assertSame(expected, fLastEvent.getHistoryService(), "Wrong refactoring history service in refactoring history event:");
}
public void assertEventType(int expected) throws Exception {
- assertNotNull("No refactoring history event has been recorded", fLastEvent);
- assertEquals("Wrong refactoring history event type:", expected, fLastEvent.getEventType());
+ assertNotNull(fLastEvent, "No refactoring history event has been recorded");
+ assertEquals(expected, fLastEvent.getEventType(), "Wrong refactoring history event type:");
}
public void connect() {
@@ -172,7 +172,7 @@ public void historyNotification(RefactoringHistoryEvent event) {
private void assertDescendingSortOrder(RefactoringDescriptorProxy[] proxies) {
for (int index= 0; index < proxies.length - 1; index++)
- assertTrue("", proxies[index].getTimeStamp() > proxies[index + 1].getTimeStamp());
+ assertTrue(proxies[index].getTimeStamp() > proxies[index + 1].getTimeStamp(), "");
}
private RefactoringDescriptor executeRefactoring(String project, int index, int flags) throws CoreException {
@@ -196,17 +196,20 @@ private void setSharedRefactoringHistory(boolean shared) throws BackingStoreExce
RefactoringHistoryService.setSharedRefactoringHistory(fProject.getProject(), shared, null);
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
final RefactoringHistoryService service= RefactoringHistoryService.getInstance();
service.connect();
fProject= new SimpleTestProject();
+ RefactoringHistory history= service.getWorkspaceHistory(null);
+ service.deleteRefactoringDescriptors(history.getDescriptors(), null);
setSharedRefactoringHistory(true);
- assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(fProject.getProject()));
+ assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(fProject.getProject()), "Refactoring history should be shared");
IFolder folder= fProject.getProject().getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER);
- assertFalse("Refactoring history folder should not exist.", folder.exists());
+ assertFalse(folder.exists(), "Refactoring history folder should not exist.");
+ service.deleteRefactoringHistory(fProject.getProject(), null);
setUpTestProjectRefactorings();
- assertTrue("Refactoring history folder should exist", folder.exists());
+ assertTrue(folder.exists(), "Refactoring history folder should exist");
}
private void setUpTestProjectRefactorings() throws CoreException {
@@ -228,14 +231,14 @@ private void setUpWorkspaceRefactorings() throws CoreException {
executeRefactoring(null, index + TOTAL_PROJECT_NUMBER, RefactoringDescriptor.BREAKING_CHANGE);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
final RefactoringHistoryService service= RefactoringHistoryService.getInstance();
service.deleteRefactoringHistory(fProject.getProject(), null);
RefactoringHistory history= service.getWorkspaceHistory(null);
service.deleteRefactoringDescriptors(history.getDescriptors(), null);
history= service.getWorkspaceHistory(null);
- assertTrue("Refactoring history must be empty", history.isEmpty());
+ assertTrue(history.isEmpty(), "Refactoring history must be empty");
service.disconnect();
fProject.delete();
}
@@ -247,12 +250,12 @@ public void testDeleteProjectHistory0() throws Exception {
final RefactoringHistoryService service= RefactoringHistoryService.getInstance();
service.deleteRefactoringHistory(project, null);
RefactoringHistory projectHistory= service.getProjectHistory(project, null);
- assertEquals("Refactoring history has wrong size:", COMMON_NUMBER, projectHistory.getDescriptors().length);
+ assertEquals(COMMON_NUMBER, projectHistory.getDescriptors().length, "Refactoring history has wrong size:");
RefactoringHistory workspaceHistory= service.getWorkspaceHistory(null);
final RefactoringDescriptorProxy[] descriptors= workspaceHistory.getDescriptors();
- assertEquals("Refactoring history has wrong size:", COMMON_NUMBER, descriptors.length);
+ assertEquals(COMMON_NUMBER, descriptors.length, "Refactoring history has wrong size:");
for (RefactoringDescriptorProxy descriptor : descriptors) {
- assertNull("Workspace refactoring should have no project attribute set:\n\n" + descriptor.toString(), descriptor.getProject());
+ assertNull(descriptor.getProject(), "Workspace refactoring should have no project attribute set:\n\n" + descriptor.toString());
}
}
@@ -271,12 +274,12 @@ public void testDeleteProjectHistory1() throws Exception {
service.deleteRefactoringDescriptors(set.toArray(new RefactoringDescriptorProxy[set.size()]), null);
workspaceHistory= service.getWorkspaceHistory(null);
RefactoringHistory projectHistory= service.getProjectHistory(project, null);
- assertEquals("Refactoring history should be the same:", projectHistory, workspaceHistory);
+ assertEquals(projectHistory, workspaceHistory, "Refactoring history should be the same:");
service.deleteRefactoringHistory(project, null);
projectHistory= service.getProjectHistory(project, null);
- assertTrue("Refactoring history should be empty", projectHistory.isEmpty());
+ assertTrue(projectHistory.isEmpty(), "Refactoring history should be empty");
workspaceHistory= service.getWorkspaceHistory(null);
- assertTrue("Refactoring history should be empty", workspaceHistory.isEmpty());
+ assertTrue(workspaceHistory.isEmpty(), "Refactoring history should be empty");
}
@Test
@@ -284,13 +287,13 @@ public void testDeleteRefactoringDescriptors0() throws Exception {
final IProject project= fProject.getProject();
final RefactoringHistoryService service= RefactoringHistoryService.getInstance();
RefactoringHistory projectHistory= service.getProjectHistory(project, null);
- assertFalse("Refactoring history should not be empty", projectHistory.isEmpty());
+ assertFalse(projectHistory.isEmpty(), "Refactoring history should not be empty");
service.deleteRefactoringDescriptors(projectHistory.getDescriptors(), null);
projectHistory= service.getProjectHistory(project, null);
projectHistory= service.getProjectHistory(project, null);
- assertTrue("Refactoring history should be empty", projectHistory.isEmpty());
+ assertTrue(projectHistory.isEmpty(), "Refactoring history should be empty");
RefactoringHistory workspaceHistory= service.getWorkspaceHistory(null);
- assertTrue("Refactoring history should be empty", workspaceHistory.isEmpty());
+ assertTrue(workspaceHistory.isEmpty(), "Refactoring history should be empty");
}
@Test
@@ -299,10 +302,10 @@ public void testDeleteRefactoringDescriptors1() throws Exception {
final RefactoringHistoryService service= RefactoringHistoryService.getInstance();
RefactoringHistory workspaceHistory= service.getWorkspaceHistory(null);
RefactoringHistory projectHistory= service.getProjectHistory(project, 0, Long.MAX_VALUE, RefactoringDescriptor.BREAKING_CHANGE, null);
- assertFalse("Refactoring history should not be empty", projectHistory.isEmpty());
+ assertFalse(projectHistory.isEmpty(), "Refactoring history should not be empty");
service.deleteRefactoringDescriptors(projectHistory.getDescriptors(), null);
RefactoringHistory afterHistory= service.getWorkspaceHistory(null);
- assertEquals("", afterHistory.getDescriptors().length + BREAKING_NUMBER, workspaceHistory.getDescriptors().length);
+ assertEquals(afterHistory.getDescriptors().length + BREAKING_NUMBER, workspaceHistory.getDescriptors().length, "");
}
@Test
@@ -324,14 +327,13 @@ public void testPopDescriptor0() throws Exception {
executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED);
RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null);
RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null);
- assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory);
- assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory);
- assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length);
- assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length);
- assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory);
- assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory);
- RefactoringCore.getUndoManager().performUndo(null, null);
- historyListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(descriptor));
+ assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:");
+ assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:");
+ assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
+ assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
+ RefactoringCore.getUndoManager().performUndo(null, null); historyListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(descriptor));
historyListener.assertEventSource(service);
historyListener.assertEventType(RefactoringHistoryEvent.POPPED);
executionListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(descriptor));
@@ -346,12 +348,12 @@ public void testPopDescriptor0() throws Exception {
executionListener.assertEventType(RefactoringExecutionEvent.REDONE);
nextWorkspaceHistory= service.getWorkspaceHistory(null);
nextProjectHistory= service.getProjectHistory(fProject.getProject(), null);
- assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory);
- assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory);
- assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length);
- assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length);
- assertEquals("Refactoring history should be the same", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory);
- assertEquals("Refactoring history should be the same", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory);
+ assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:");
+ assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:");
+ assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same");
+ assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same");
} finally {
historyListener.disconnect();
executionListener.disconnect();
@@ -384,12 +386,12 @@ public void testPopDescriptor1() throws Exception {
executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED);
RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null);
RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null);
- assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory);
- assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory);
- assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length);
- assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length);
- assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousProjectHistory);
- assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousWorkspaceHistory);
+ assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:");
+ assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:");
+ assertEquals(previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same:");
+ assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same:");
RefactoringCore.getUndoManager().performUndo(null, null);
historyListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(secondDescriptor));
historyListener.assertEventSource(service);
@@ -420,12 +422,12 @@ public void testPopDescriptor1() throws Exception {
executionListener.assertEventType(RefactoringExecutionEvent.REDONE);
nextWorkspaceHistory= service.getWorkspaceHistory(null);
nextProjectHistory= service.getProjectHistory(fProject.getProject(), null);
- assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory);
- assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory);
- assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length);
- assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length);
- assertEquals("Refactoring history should be the same", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousProjectHistory);
- assertEquals("Refactoring history should be the same", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousWorkspaceHistory);
+ assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:");
+ assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:");
+ assertEquals(previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same");
+ assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same");
} finally {
historyListener.disconnect();
executionListener.disconnect();
@@ -451,12 +453,12 @@ public void testPushDescriptor0() throws Exception {
executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED);
RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null);
RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null);
- assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory);
- assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory);
- assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length);
- assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length);
- assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory);
- assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory);
+ assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:");
+ assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:");
+ assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
+ assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
} finally {
historyListener.disconnect();
executionListener.disconnect();
@@ -482,12 +484,12 @@ public void testPushDescriptor1() throws Exception {
executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED);
RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null);
RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null);
- assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory);
- assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory);
- assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length);
- assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length);
- assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory);
- assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory);
+ assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:");
+ assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:");
+ assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
+ assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
} finally {
historyListener.disconnect();
executionListener.disconnect();
@@ -514,12 +516,12 @@ public void testPushDescriptor2() throws Exception {
executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED);
RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null);
RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null);
- assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory);
- assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory);
- assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length);
- assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length);
- assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory);
- assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory);
+ assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:");
+ assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:");
+ assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:");
+ assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
+ assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:");
} finally {
historyListener.disconnect();
executionListener.disconnect();
@@ -529,107 +531,107 @@ public void testPushDescriptor2() throws Exception {
@Test
public void testReadProjectHistory0() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length);
+ assertEquals(RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadProjectHistory1() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.NONE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length);
+ assertEquals(RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadProjectHistory2() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.BREAKING_CHANGE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", BREAKING_NUMBER, proxies.length);
+ assertEquals(BREAKING_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadProjectHistory3() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.STRUCTURAL_CHANGE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", STRUCTURAL_NUMBER, proxies.length);
+ assertEquals(STRUCTURAL_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadProjectHistory4() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.MULTI_CHANGE, null);
- assertTrue("Refactoring history should be empty", history.isEmpty());
+ assertTrue(history.isEmpty(), "Refactoring history should be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 0, proxies.length);
+ assertEquals(0, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadProjectHistory5() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, CUSTOM_FLAG, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", CUSTOM_NUMBER, proxies.length);
+ assertEquals(CUSTOM_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadProjectHistory6() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, STAMP_FACTOR, CUSTOM_FLAG, null);
- assertTrue("Refactoring history should be empty", history.isEmpty());
+ assertTrue(history.isEmpty(), "Refactoring history should be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 0, proxies.length);
+ assertEquals(0, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadRefactoringHistory0() throws Exception {
setUpWorkspaceRefactorings();
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length);
+ assertEquals(RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadRefactoringHistory1() throws Exception {
setUpWorkspaceRefactorings();
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, Long.MAX_VALUE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length);
+ assertEquals(RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadWorkspaceHistory0() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, STAMP_FACTOR, null);
- assertFalse("Refactoring history should be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history should be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 1, proxies.length);
+ assertEquals(1, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadWorkspaceHistory1() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, Long.MAX_VALUE, null);
- assertFalse("Refactoring history should be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history should be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", TOTAL_PROJECT_NUMBER, proxies.length);
+ assertEquals(TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadWorkspaceHistory2() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(STAMP_FACTOR, STAMP_FACTOR * 5, null);
- assertFalse("Refactoring history should be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history should be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 5, proxies.length);
+ assertEquals(5, proxies.length, "Refactoring history has wrong size");
}
@Test
public void testReadWorkspaceHistory3() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(STAMP_FACTOR * 3, STAMP_FACTOR * 5, null);
- assertFalse("Refactoring history should be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history should be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 3, proxies.length);
+ assertEquals(3, proxies.length, "Refactoring history has wrong size");
}
@Test
@@ -637,14 +639,14 @@ public void testSharing0() throws Exception {
final IProject project= fProject.getProject();
final RefactoringHistoryService service= RefactoringHistoryService.getInstance();
RefactoringHistory previousHistory= service.getProjectHistory(project, null);
- assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project));
+ assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should be shared");
IFolder folder= fProject.getProject().getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER);
- assertTrue("Refactoring history folder should exist.", folder.exists());
+ assertTrue(folder.exists(), "Refactoring history folder should exist.");
setSharedRefactoringHistory(false);
RefactoringHistory nextHistory= service.getProjectHistory(project, null);
- assertEquals("Refactoring history should be the same:", previousHistory, nextHistory);
- assertFalse("Refactoring history should not be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project));
- assertFalse("Refactoring history folder should not exist.", folder.exists());
+ assertEquals(previousHistory, nextHistory, "Refactoring history should be the same:");
+ assertFalse(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should not be shared");
+ assertFalse(folder.exists(), "Refactoring history folder should not exist.");
}
@Test
@@ -652,92 +654,92 @@ public void testSharing1() throws Exception {
final IProject project= fProject.getProject();
final RefactoringHistoryService service= RefactoringHistoryService.getInstance();
RefactoringHistory previousHistory= service.getProjectHistory(project, null);
- assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project));
+ assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should be shared");
IFolder folder= fProject.getProject().getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER);
- assertTrue("Refactoring history folder should exist.", folder.exists());
+ assertTrue(folder.exists(), "Refactoring history folder should exist.");
setSharedRefactoringHistory(false);
RefactoringHistory nextHistory= service.getProjectHistory(project, null);
- assertEquals("Refactoring history should be the same:", previousHistory, nextHistory);
- assertFalse("Refactoring history should not be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project));
- assertFalse("Refactoring history folder should not exist.", folder.exists());
+ assertEquals(previousHistory, nextHistory, "Refactoring history should be the same:");
+ assertFalse(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should not be shared");
+ assertFalse(folder.exists(), "Refactoring history folder should not exist.");
setSharedRefactoringHistory(true);
RefactoringHistory lastHistory= service.getProjectHistory(project, null);
- assertEquals("Refactoring history should be the same:", previousHistory, lastHistory);
- assertEquals("Refactoring history should be the same:", nextHistory, lastHistory);
- assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project));
- assertTrue("Refactoring history folder should exist.", folder.exists());
+ assertEquals(previousHistory, lastHistory, "Refactoring history should be the same:");
+ assertEquals(nextHistory, lastHistory, "Refactoring history should be the same:");
+ assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should be shared");
+ assertTrue(folder.exists(), "Refactoring history folder should exist.");
}
@Test
public void testSortOrder0() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length);
+ assertEquals(RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
@Test
public void testSortOrder1() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR, STAMP_FACTOR * 5, RefactoringDescriptor.NONE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 5, proxies.length);
+ assertEquals(5, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
@Test
public void testSortOrder2() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR * 3, STAMP_FACTOR * 5, RefactoringDescriptor.NONE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 3, proxies.length);
+ assertEquals(3, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
@Test
public void testSortOrder3() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR * (NONE_NUMBER + 1), STAMP_FACTOR * (NONE_NUMBER + 4), RefactoringDescriptor.BREAKING_CHANGE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 4, proxies.length);
+ assertEquals(4, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
@Test
public void testSortOrder4() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR * (NONE_NUMBER + 1), STAMP_FACTOR * (NONE_NUMBER + 18), RefactoringDescriptor.NONE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 18, proxies.length);
+ assertEquals(18, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
@Test
public void testSortOrder5() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, CUSTOM_FLAG, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", CUSTOM_NUMBER, proxies.length);
+ assertEquals(CUSTOM_NUMBER, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
@Test
public void testSortOrder6() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, Long.MAX_VALUE, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", TOTAL_PROJECT_NUMBER, proxies.length);
+ assertEquals(TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
@Test
public void testSortOrder7() throws Exception {
RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(STAMP_FACTOR * 3, STAMP_FACTOR * 5, null);
- assertFalse("Refactoring history must not be empty", history.isEmpty());
+ assertFalse(history.isEmpty(), "Refactoring history must not be empty");
RefactoringDescriptorProxy[] proxies= history.getDescriptors();
- assertEquals("Refactoring history has wrong size", 3, proxies.length);
+ assertEquals(3, proxies.length, "Refactoring history has wrong size");
assertDescendingSortOrder(proxies);
}
-}
\ No newline at end of file
+}
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java
index 1c1c1c18be4..b947733e023 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java
@@ -13,16 +13,16 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
@@ -131,14 +131,14 @@ public RefactoringParticipant[] loadParticipants(RefactoringStatus status, Shara
private ILogListener fLogListener;
private List fLogEntries;
- @Before
+ @BeforeEach
public void setUp() {
fLogListener= (status, plugin) -> fLogEntries.add(status);
Platform.addLogListener(fLogListener);
fLogEntries= new ArrayList<>();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
Platform.removeLogListener(fLogListener);
}
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java
index 6b276afed77..49ae8cbbf45 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java
@@ -15,17 +15,17 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.tests.harness.FussyProgressMonitor;
@@ -44,13 +44,13 @@ public class FailingParticipantTests {
private ILogListener fLogListener;
private List fLogEntries;
- @Before
+ @BeforeEach
public void setUp() {
fLogListener= (status, plugin) -> fLogEntries.add(status);
Platform.addLogListener(fLogListener);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
Platform.removeLogListener(fLogListener);
}
@@ -84,8 +84,8 @@ public void testFailingParticipants() throws Exception {
assertEquals(1, fLogEntries.size());
IStatus status= fLogEntries.get(0);
- assertEquals("Exception wrong", status.getException().getClass(), FailingParticipant.Exception.class);
- assertTrue("No exception generated", exception);
+ assertEquals(FailingParticipant.Exception.class, status.getException().getClass(), "Exception wrong");
+ assertTrue(exception, "No exception generated");
resetLog();
@@ -113,8 +113,8 @@ public void testFailingParticipants() throws Exception {
assertEquals(1, fLogEntries.size());
status= fLogEntries.get(0);
- assertEquals("Exception wrong", status.getException().getClass(), FailingParticipant2.Exception.class);
- assertTrue("No exception generated", exception);
+ assertEquals(FailingParticipant2.Exception.class, status.getException().getClass(), "Exception wrong");
+ assertTrue(exception, "No exception generated");
resetLog();
@@ -136,7 +136,7 @@ public void testFailingParticipants() throws Exception {
pm.prepare();
assertEquals(0, fLogEntries.size());
- assertTrue("Working participant not executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC));
+ assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant not executed");
}
// If the main refactoring fails to execute, disable any participants contributing preChanges
@@ -167,21 +167,21 @@ public void testFailingRefactorWithPreParticipants() throws Exception {
//System.out.println(fLogEntries);
assertEquals(2, fLogEntries.size());
IStatus status= fLogEntries.get(0);
- assertEquals("Exception wrong", status.getException().getClass(), RuntimeException.class);
- assertEquals("Status code wrong", IRefactoringCoreStatusCodes.REFACTORING_EXCEPTION_DISABLED_PARTICIPANTS, status.getCode());
+ assertEquals(RuntimeException.class, status.getException().getClass(), "Exception wrong");
+ assertEquals(IRefactoringCoreStatusCodes.REFACTORING_EXCEPTION_DISABLED_PARTICIPANTS, status.getCode(), "Status code wrong");
status= fLogEntries.get(1);
- assertNull("Exception wrong", status.getException());
- assertEquals("Status code wrong", IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED, status.getCode());
- assertTrue("No exception generated", exception);
+ assertNull(status.getException(), "Exception wrong");
+ assertEquals(IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED, status.getCode(), "Status code wrong");
+ assertTrue(exception, "No exception generated");
//System.out.println(ElementRenameProcessor.fHistory);
- assertTrue("Working participant not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE));
- assertFalse("Working participant executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC));
- assertTrue("Working participant pre not created pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE));
- assertTrue("Working participant pre not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE));
- assertTrue("Working participant pre not executed pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE));
- assertFalse("Working participant pre executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC));
+ assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE), "Working participant not created");
+ assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant executed");
+ assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE), "Working participant pre not created pre");
+ assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE), "Working participant pre not created");
+ assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE), "Working participant pre not executed pre");
+ assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC), "Working participant pre executed");
// Now try it again and the working participant should not be called at all,
@@ -197,12 +197,12 @@ public void testFailingRefactorWithPreParticipants() throws Exception {
assertEquals(0, fLogEntries.size());
- assertTrue("Working participant not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE));
- assertTrue("Working participant not executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC));
- assertFalse("Working participant pre created pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE));
- assertFalse("Working participant pre created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE));
- assertFalse("Working participant pre executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC));
- assertFalse("Working participant pre executed pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE));
+ assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE), "Working participant not created");
+ assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant not executed");
+ assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE), "Working participant pre created pre");
+ assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE), "Working participant pre created");
+ assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC), "Working participant pre executed");
+ assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE), "Working participant pre executed pre");
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java
index 3e456664ecf..e9e77add908 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java
@@ -13,16 +13,16 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -196,12 +196,12 @@ private void getModifiedFiles(List result, Change[] changes) {
}
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
fProject= new SimpleTestProject();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
fProject.delete();
}
@@ -218,10 +218,10 @@ public void testMoveRefactoringWithParticipants() throws Exception {
PerformRefactoringOperation op= new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
ResourcesPlugin.getWorkspace().run(op, null);
- assertTrue("File is not moved", this.fProject.getProject().getFolder("dest").getFile("fileToMove.txt").exists());
+ assertTrue(this.fProject.getProject().getFolder("dest").getFile("fileToMove.txt").exists(), "File is not moved");
String actual= fProject.getContent(fileToUpdate);
//reference has to be updated only once despite two changes are supplied.
assertEquals("using dest.fileToMove.txt;\nusing someOther.txt", actual);
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java
index 7c56ad68e64..eb88f4375e8 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java
@@ -13,11 +13,11 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -119,12 +119,12 @@ public RefactoringParticipant[] loadParticipants(RefactoringStatus status, Shara
}
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
fProject= new SimpleTestProject();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
fProject.delete();
}
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java
index 3e77001f537..8b075f415a7 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java
@@ -14,16 +14,16 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.resource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.filesystem.EFS;
@@ -59,12 +59,12 @@
public class ResourceRefactoringTests {
private SimpleTestProject fProject;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
fProject= new SimpleTestProject();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
fProject.delete();
}
@@ -304,7 +304,7 @@ public void testDeleteRefactoring1_bug343584() throws Exception {
IFolder testFolder= fProject.createFolder("test");
fProject.createFile(testFolder, "myFile.txt", "hello");
- IProject testProject2= ResourcesPlugin.getWorkspace().getRoot().getProject(SimpleTestProject.TEST_PROJECT_NAME + "2");
+ IProject testProject2= ResourcesPlugin.getWorkspace().getRoot().getProject(fProject.getProject().getName() + "2");
try {
testProject2.create(null);
testProject2.open(null);
@@ -468,4 +468,4 @@ private IResource assertMoveRename(IResource source, IContainer destination, Str
}
return res;
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java
index dd69a4654c5..e9ce3bc0844 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java
@@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.resource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -31,9 +31,9 @@
import java.util.Map;
import java.util.Set;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IOperationHistory;
@@ -98,7 +98,7 @@ public class ResourceRefactoringUndoTests {
private IFile testLinkedFile;
private IFolder testSubFolder;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
fProject= new SimpleTestProject();
@@ -126,7 +126,7 @@ public void setUp() throws Exception {
context= RefactoringCorePlugin.getUndoContext();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
fProject.delete();
final IFileStore[] toDelete= storesToDelete.toArray(new IFileStore[storesToDelete.size()]);
@@ -149,18 +149,18 @@ public void testFileRenameUndoRedoLTK() throws ExecutionException, CoreException
execute(op);
IFile renamedFile= testFolder.getFile(TEST_NEWFILE_NAME);
- assertTrue("File rename failed", renamedFile.exists());
+ assertTrue(renamedFile.exists(), "File rename failed");
snap.name= TEST_NEWFILE_NAME;
- assertTrue("File CONTENT was altered on rename", snap.isValid(testFolder));
+ assertTrue(snap.isValid(testFolder), "File CONTENT was altered on rename");
undo();
snap.name= TEST_FILE_NAME;
- assertTrue("File CONTENT was altered on undo rename", snap.isValid(testFolder));
- assertFalse("Undo rename failed", renamedFile.exists());
+ assertTrue(snap.isValid(testFolder), "File CONTENT was altered on undo rename");
+ assertFalse(renamedFile.exists(), "Undo rename failed");
redo();
snap.name= TEST_NEWFILE_NAME;
- assertTrue("File CONTENT was altered on redo rename", snap.isValid(testFolder));
+ assertTrue(snap.isValid(testFolder), "File CONTENT was altered on redo rename");
}
@Test
@@ -174,18 +174,18 @@ public void testFolderRenameUndoRedoLTK() throws ExecutionException, CoreExcepti
FolderSnapshot snap= new FolderSnapshot(testFolder);
execute(op);
IFolder renamedFolder= fProject.getProject().getFolder(TEST_NEWFOLDER_NAME);
- assertTrue("Project rename failed", renamedFolder.exists());
+ assertTrue(renamedFolder.exists(), "Project rename failed");
snap.name= TEST_NEWFOLDER_NAME;
- assertTrue("Folder CONTENT was altered on rename", snap.isValid(fProject.getProject()));
+ assertTrue(snap.isValid(fProject.getProject()), "Folder CONTENT was altered on rename");
undo();
snap.name= TEST_FOLDER_NAME;
- assertTrue("Folder CONTENT was altered on undo rename", snap.isValid(fProject.getProject()));
- assertFalse("Undo rename failed", renamedFolder.exists());
+ assertTrue(snap.isValid(fProject.getProject()), "Folder CONTENT was altered on undo rename");
+ assertFalse(renamedFolder.exists(), "Undo rename failed");
redo();
snap.name= TEST_NEWFOLDER_NAME;
- assertTrue("Folder CONTENT was altered on redo rename", snap.isValid(fProject.getProject()));
+ assertTrue(snap.isValid(fProject.getProject()), "Folder CONTENT was altered on redo rename");
}
@Test
@@ -200,16 +200,16 @@ public void testProjectRenameUndoRedoLTK() throws ExecutionException, CoreExcept
execute(op);
IProject renamedProject= getWorkspaceRoot().getProject(TEST_NEWPROJECT_NAME);
try {
- assertTrue("Project rename failed", renamedProject.exists());
+ assertTrue(renamedProject.exists(), "Project rename failed");
snap.name= TEST_NEWPROJECT_NAME;
- assertTrue("Project CONTENT was altered on rename", snap.isValid());
+ assertTrue(snap.isValid(), "Project CONTENT was altered on rename");
undo();
- snap.name= SimpleTestProject.TEST_PROJECT_NAME;
- assertTrue("Project CONTENT was altered on undo rename", snap.isValid());
- assertFalse("Undo rename failed", renamedProject.exists());
+ snap.name= fProject.getProject().getName();
+ assertTrue(snap.isValid(), "Project CONTENT was altered on undo rename");
+ assertFalse(renamedProject.exists(), "Undo rename failed");
redo();
snap.name= TEST_NEWPROJECT_NAME;
- assertTrue("Project CONTENT was altered on redo rename", snap.isValid());
+ assertTrue(snap.isValid(), "Project CONTENT was altered on redo rename");
} finally {
renamedProject.delete(true, true, null);
}
@@ -227,12 +227,12 @@ public void testFileDeleteUndoRedoLTK() throws ExecutionException, CoreException
execute(op);
- assertFalse("File delete failed", testFile.exists());
+ assertFalse(testFile.exists(), "File delete failed");
undo();
- assertTrue("File recreation failed", testFile.exists());
- assertTrue("File CONTENT was altered on undo", snap.isValid(testFile.getParent()));
+ assertTrue(testFile.exists(), "File recreation failed");
+ assertTrue(snap.isValid(testFile.getParent()), "File CONTENT was altered on undo");
redo();
- assertFalse("Redo delete failed", testFile.exists());
+ assertFalse(testFile.exists(), "Redo delete failed");
}
@Test
@@ -247,12 +247,12 @@ public void testFileLinkedDeleteUndoRedoLTK() throws ExecutionException, CoreExc
execute(op);
- assertFalse("File delete failed", testLinkedFile.exists());
+ assertFalse(testLinkedFile.exists(), "File delete failed");
undo();
- assertTrue("File recreation failed", testLinkedFile.exists());
- assertTrue("File CONTENT was altered on undo", snap.isValid(testLinkedFile.getParent()));
+ assertTrue(testLinkedFile.exists(), "File recreation failed");
+ assertTrue(snap.isValid(testLinkedFile.getParent()), "File CONTENT was altered on undo");
redo();
- assertFalse("Redo delete failed", testLinkedFile.exists());
+ assertFalse(testLinkedFile.exists(), "Redo delete failed");
}
@Test
@@ -267,12 +267,12 @@ public void testFolderDeleteUndoRedoLTK() throws ExecutionException, CoreExcepti
execute(op);
- assertFalse("Folder delete failed", testSubFolder.exists());
+ assertFalse(testSubFolder.exists(), "Folder delete failed");
undo();
- assertTrue("Folder recreation failed", testSubFolder.exists());
- assertTrue("Folder CONTENT was altered on undo", snap.isValid(testSubFolder.getParent()));
+ assertTrue(testSubFolder.exists(), "Folder recreation failed");
+ assertTrue(snap.isValid(testSubFolder.getParent()), "Folder CONTENT was altered on undo");
redo();
- assertFalse("Redo delete failed", testSubFolder.exists());
+ assertFalse(testSubFolder.exists(), "Redo delete failed");
}
@Test
@@ -285,12 +285,12 @@ public void testFolderDeleteLinkedUndoRedoLTK() throws ExecutionException, CoreE
FolderSnapshot snap= new FolderSnapshot(testLinkedFolder);
execute(op);
- assertFalse("Folder delete failed", testLinkedFolder.exists());
+ assertFalse(testLinkedFolder.exists(), "Folder delete failed");
undo();
- assertTrue("Folder recreation failed", testLinkedFolder.exists());
- assertTrue("Folder CONTENT was altered on undo", snap.isValid(testLinkedFolder.getParent()));
+ assertTrue(testLinkedFolder.exists(), "Folder recreation failed");
+ assertTrue(snap.isValid(testLinkedFolder.getParent()), "Folder CONTENT was altered on undo");
redo();
- assertFalse("Redo delete failed", testLinkedFolder.exists());
+ assertFalse(testLinkedFolder.exists(), "Redo delete failed");
}
@Test
@@ -316,12 +316,12 @@ public void testFolderDeleteLinkedDeletedOnFilesystemUndoRedoLTK() throws Execut
folderStore.delete(EFS.NONE, getMonitor()); // Delete the target folder on the file system.
execute(op);
- assertFalse("Folder delete failed", testLinkedFolder.exists());
+ assertFalse(testLinkedFolder.exists(), "Folder delete failed");
undo();
- assertTrue("Folder recreation failed", testLinkedFolder.exists());
- assertTrue("Folder CONTENT was altered on undo", snap.isValid(testLinkedFolder.getParent()));
+ assertTrue(testLinkedFolder.exists(), "Folder recreation failed");
+ assertTrue(snap.isValid(testLinkedFolder.getParent()), "Folder CONTENT was altered on undo");
redo();
- assertFalse("Redo delete failed", testLinkedFolder.exists());
+ assertFalse(testLinkedFolder.exists(), "Redo delete failed");
}
@Test
@@ -333,19 +333,19 @@ public void testProjectDeleteUndoRedoLTK() throws ExecutionException, CoreExcept
PerformRefactoringOperation op= new PerformRefactoringOperation(desc.createRefactoringContext(new RefactoringStatus()), CheckConditionsOperation.ALL_CONDITIONS);
execute(op);
- assertFalse("Project delete failed", fProject.getProject().exists());
+ assertFalse(fProject.getProject().exists(), "Project delete failed");
undo();
- assertTrue("Project recreation failed", fProject.getProject().exists());
+ assertTrue(fProject.getProject().exists(), "Project recreation failed");
// Ideally we could run this test everytime, but it fails intermittently
// because opening the recreated project occurs in the background, and
// the creation of the workspace representation for the disk contents
// may not have happened yet. This test always passes under debug where
// timing can be controlled.
// ***********
-// assertTrue("Project CONTENT was altered on undo", snap.isValid());
+// assertTrue(snap.isValid(), "Project CONTENT was altered on undo");
// ************
redo();
- assertFalse("Redo delete failed", fProject.getProject().exists());
+ assertFalse(fProject.getProject().exists(), "Redo delete failed");
// We undo again so that the project will exist during teardown and
// get cleaned up. Otherwise some CONTENT is left on disk.
undo();
@@ -368,11 +368,11 @@ public void testProjectDeleteWithContentUndoRedoLTK() throws ExecutionException,
// we don't snapshot since CONTENT will be deleted
execute(op);
- assertFalse("Project delete failed", fProject.getProject().exists());
+ assertFalse(fProject.getProject().exists(), "Project delete failed");
undo();
- assertTrue("Project was recreated", fProject.getProject().exists());
+ assertTrue(fProject.getProject().exists(), "Project was recreated");
redo();
- assertFalse("Redo delete failed", fProject.getProject().exists());
+ assertFalse(fProject.getProject().exists(), "Redo delete failed");
}
@Test
@@ -425,15 +425,15 @@ private IWorkspaceRoot getWorkspaceRoot() {
}
private void undo() throws ExecutionException {
- assertTrue("Operation can be undone", history.canUndo(context));
+ assertTrue(history.canUndo(context), "Operation can be undone");
IStatus status= history.undo(context, getMonitor(), null);
- assertTrue("Undo should be OK status", status.isOK());
+ assertTrue(status.isOK(), "Undo should be OK status");
}
private void redo() throws ExecutionException {
- assertTrue("Operation can be redone", history.canRedo(context));
+ assertTrue(history.canRedo(context), "Operation can be redone");
IStatus status= history.redo(context, getMonitor(), null);
- assertTrue("Redo should be OK status", status.isOK());
+ assertTrue(status.isOK(), "Redo should be OK status");
}
private IProgressMonitor getMonitor() {
@@ -662,4 +662,4 @@ IWorkspaceRoot getWorkspaceRoot() {
return ResourcesPlugin.getWorkspace().getRoot();
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java
index 41e431944d1..e75f42fca09 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java
@@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.scripting;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RefactoringScriptApplicationTests {
diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java
index 2074309d6cd..c7e204b5bee 100644
--- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java
+++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java
@@ -35,7 +35,7 @@ public class SimpleTestProject {
public SimpleTestProject() throws CoreException {
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- fProject= root.getProject(TEST_PROJECT_NAME);
+ fProject= root.getProject(TEST_PROJECT_NAME + System.nanoTime());
fProject.create(null);
fProject.open(null);
}
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF
index dc7e76865c4..c39e7b8fbdd 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF
@@ -25,4 +25,6 @@ Automatic-Module-Name: org.eclipse.ui.workbench.texteditor.tests
Import-Package: org.mockito,
org.mockito.stubbing;version="5.5.0",
org.junit.jupiter.api;version="[5.14.0,6.0.0)",
- org.junit.platform.suite.api;version="[1.14.0,2.0.0)"
+ org.junit.jupiter.api.function;version="[5.14.0,6.0.0)",
+ org.junit.platform.suite.api;version="[1.14.0,2.0.0)",
+ org.opentest4j;version="[1.3.0,2.0.0)"
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java
index 86e141fdf19..0bd4c1ed9c3 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java
@@ -20,9 +20,9 @@
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
@@ -33,9 +33,9 @@
import java.util.function.Predicate;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.eclipse.swt.SWT;
@@ -86,14 +86,14 @@ private void setFindAndReplaceString(IFindReplaceLogic findReplaceLogic, String
findReplaceLogic.setReplaceString(replaceString);
}
- @After
+ @AfterEach
public void disposeShell() {
if (parentShell != null) {
parentShell.dispose();
}
}
- @Before
+ @BeforeEach
public void setupShell() {
parentShell= new Shell();
}
@@ -252,8 +252,8 @@ public void testPerformSelectAndReplaceRegEx() {
expectStatusEmpty(findReplaceLogic);
status= findReplaceLogic.performSelectAndReplace();
- assertEquals("Status wasn't correctly returned", false, status);
- assertEquals("Text shouldn't have been changed", "Hello World !", textViewer.getDocument().get());
+ assertEquals(false, status, "Status wasn't correctly returned");
+ assertEquals("Hello World !", textViewer.getDocument().get(), "Text shouldn't have been changed");
expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH);
}
@@ -288,12 +288,12 @@ public void testPerformSelectAndReplaceRegExWithLinebreaks() {
expectStatusEmpty(findReplaceLogic);
setFindAndReplaceString(findReplaceLogic, """
- """, " ");
+ """, " ");
status= findReplaceLogic.performSelectAndReplace();
- assertEquals("Status wasn't correctly returned", false, status);
- assertEquals("Text shouldn't have been changed", """
+ assertEquals(false, status, "Status wasn't correctly returned");
+ assertEquals("""
Hello!
- World!""", textViewer.getDocument().get());
+ World!""", textViewer.getDocument().get(), "Text shouldn't have been changed");
}
@Test
@@ -324,8 +324,8 @@ public void testPerformSelectAndReplaceWithConfigurationChanges() {
expectStatusEmpty(findReplaceLogic);
status= findReplaceLogic.performSelectAndReplace();
- assertEquals("Status wasn't correctly returned", false, status);
- assertEquals("Text shouldn't have been changed", "Hello World ! !", textViewer.getDocument().get());
+ assertEquals(false, status, "Status wasn't correctly returned");
+ assertEquals("Hello World ! !", textViewer.getDocument().get(), "Text shouldn't have been changed");
expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH);
}
@@ -355,20 +355,20 @@ public void testPerformReplaceAndFind_caseInsensitive() {
setFindAndReplaceString(findReplaceLogic, "", " ");
boolean status= findReplaceLogic.performReplaceAndFind();
- assertTrue("replace should have been performed", status);
+ assertTrue(status, "replace should have been performed");
assertThat(textViewer.getDocument().get(), equalTo("Hello World!"));
assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo(""));
expectStatusEmpty(findReplaceLogic);
setFindAndReplaceString(findReplaceLogic, "", " ");
status= findReplaceLogic.performReplaceAndFind();
- assertTrue("replace should have been performed", status);
+ assertTrue(status, "replace should have been performed");
assertThat(textViewer.getDocument().get(), equalTo("Hello World !"));
expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH);
status= findReplaceLogic.performReplaceAndFind();
- assertFalse("replace should not have been performed", status);
- assertEquals("Text shouldn't have been changed", "Hello World !", textViewer.getDocument().get());
+ assertFalse(status, "replace should not have been performed");
+ assertEquals("Hello World !", textViewer.getDocument().get(), "Text shouldn't have been changed");
expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH);
}
@@ -381,12 +381,12 @@ public void testPerformReplaceAndFind_caseSensitive() {
setFindAndReplaceString(findReplaceLogic, "", " ");
boolean status= findReplaceLogic.performReplaceAndFind();
- assertTrue("replace should have been performed", status);
+ assertTrue(status, "replace should have been performed");
assertThat(textViewer.getDocument().get(), equalTo("HelloWorld !"));
assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo(" "));
status= findReplaceLogic.performReplaceAndFind();
- assertFalse("replace should not have been performed", status);
+ assertFalse(status, "replace should not have been performed");
assertThat(textViewer.getDocument().get(), equalTo("HelloWorld !"));
assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo(" "));
}
@@ -400,20 +400,20 @@ public void testPerformReplaceAndFind_caseSensitiveAndIncremental() {
setFindAndReplaceString(findReplaceLogic, "", " ");
boolean status= findReplaceLogic.performReplaceAndFind();
- assertTrue("replace should have been performed", status);
+ assertTrue(status, "replace should have been performed");
assertThat(textViewer.getDocument().get(), equalTo("Hello World!"));
assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo(""));
expectStatusEmpty(findReplaceLogic);
setFindAndReplaceString(findReplaceLogic, "", " ");
status= findReplaceLogic.performReplaceAndFind();
- assertTrue("replace should have been performed", status);
+ assertTrue(status, "replace should have been performed");
assertThat(textViewer.getDocument().get(), equalTo("Hello World !"));
expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH);
status= findReplaceLogic.performReplaceAndFind();
- assertFalse("replace should not have been performed", status);
- assertEquals("Text shouldn't have been changed", "Hello World !", textViewer.getDocument().get());
+ assertFalse(status, "replace should not have been performed");
+ assertEquals("Hello World !", textViewer.getDocument().get(), "Text shouldn't have been changed");
expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH);
}
@@ -484,8 +484,8 @@ private void executeReplaceAndFindRegExTest(TextViewer textViewer, IFindReplaceL
setFindAndReplaceString(findReplaceLogic, "<(\\w*)>", " ");
status= findReplaceLogic.performReplaceAndFind();
- assertEquals("Status wasn't correctly returned", false, status);
- assertEquals("Text shouldn't have been changed", "Hello World ! !", textViewer.getDocument().get());
+ assertEquals(false, status, "Status wasn't correctly returned");
+ assertEquals("Hello World ! !", textViewer.getDocument().get(), "Text shouldn't have been changed");
expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH);
}
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java
index 945d2ccfb3a..f07f1107443 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java
@@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.ui.internal.findandreplace;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.function.Supplier;
@@ -60,4 +60,4 @@ public static void waitForFocus(Supplier hasFocusValidator, String test
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java
index a2483353bed..c253586ccc3 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java
@@ -10,20 +10,19 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- *******************************************************************************/
+ ******************************************************************************/
package org.eclipse.ui.internal.findandreplace;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ResourceBundle;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import org.eclipse.swt.SWT;
@@ -37,8 +36,8 @@
import org.eclipse.ui.texteditor.FindReplaceAction;
public abstract class FindReplaceUITest {
- @Rule
- public TestName testName= new TestName();
+
+ protected TestInfo testInfo;
private TextViewer fTextViewer;
@@ -46,8 +45,9 @@ public abstract class FindReplaceUITest
private AccessType dialog;
- @Before
- public final void ensureWorkbenchWindowIsActive() {
+ @BeforeEach
+ public final void ensureWorkbenchWindowIsActive(TestInfo info) {
+ this.testInfo = info;
PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell().forceActive();
}
@@ -80,7 +80,7 @@ protected void reopenFindReplaceUIForTextViewer() {
protected abstract AccessType openUIFromTextViewer(TextViewer viewer);
- @After
+ @AfterEach
public void tearDown() throws Exception {
if (dialog != null) {
dialog.closeAndRestore();
@@ -388,4 +388,4 @@ protected final IFindReplaceTarget getFindReplaceTarget() {
return fTextViewer.getFindReplaceTarget();
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java
index 6f9df565c2a..ee073791589 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java
@@ -16,10 +16,10 @@
import static org.eclipse.ui.internal.findandreplace.FindReplaceTestUtil.waitForFocus;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.swt.graphics.Point;
@@ -48,7 +48,7 @@ public OverlayAccess openUIFromTextViewer(TextViewer viewer) {
actionAccessor.invoke("showOverlayInEditor");
FindReplaceOverlay overlay= (FindReplaceOverlay) actionAccessor.get("overlay");
OverlayAccess uiAccess= new OverlayAccess(getFindReplaceTarget(), overlay);
- waitForFocus(uiAccess::hasFocus, testName.getMethodName());
+ waitForFocus(uiAccess::hasFocus, testInfo.getTestMethod().get().getName());
return uiAccess;
}
@@ -177,7 +177,7 @@ public void testDisableOverlayViaPreference() {
boolean useOverlayPreference= preferences.getBoolean(USE_FIND_REPLACE_OVERLAY, true);
try {
preferences.putBoolean(USE_FIND_REPLACE_OVERLAY, false);
- assertFalse("dialog should be closed after changing preference", getDialog().isShown());
+ assertFalse(getDialog().isShown(), "dialog should be closed after changing preference");
} finally {
preferences.putBoolean(USE_FIND_REPLACE_OVERLAY, useOverlayPreference);
reopenFindReplaceUIForTextViewer();
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java
index 05f6f2317de..38525748d76 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java
@@ -13,9 +13,9 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.swt.widgets.Composite;
@@ -231,4 +231,4 @@ public Object getSelectedPage() {
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java
index 4b73154d480..550eb437aba 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java
@@ -14,10 +14,10 @@
package org.eclipse.ui.workbench.texteditor.tests;
import static org.eclipse.jface.text.DocumentRewriteSessionType.SEQUENTIAL;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
@@ -169,4 +169,4 @@ public void nonSuspendedLineDifferStaysNonSuspendedAfterDocumentRewriteSession()
assertFalse(fLineDiffer.isSuspended());
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
index b0498aaf3dd..970be44ffbb 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
@@ -17,11 +17,11 @@
import static org.eclipse.ui.internal.findandreplace.FindReplaceTestUtil.waitForFocus;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
@@ -54,13 +54,13 @@ public DialogAccess openUIFromTextViewer(TextViewer viewer) {
Dialog dialog= (Dialog) fFindReplaceDialogStubAccessor.invoke("getDialog");
DialogAccess uiAccess= new DialogAccess(getFindReplaceTarget(), dialog);
- waitForFocus(uiAccess::hasFocus, testName.getMethodName());
+ waitForFocus(uiAccess::hasFocus, testInfo.getTestMethod().get().getName());
return uiAccess;
}
@Test
public void testFocusNotChangedWhenEnterPressed() {
- assumeFalse("On Mac, checkboxes only take focus if 'Full Keyboard Access' is enabled in the system preferences", Util.isMac());
+ assumeFalse(Util.isMac(), "On Mac, checkboxes only take focus if 'Full Keyboard Access' is enabled in the system preferences");
initializeTextViewerWithFindReplaceUI("line\nline\nline");
DialogAccess dialog= getDialog();
@@ -68,22 +68,22 @@ public void testFocusNotChangedWhenEnterPressed() {
dialog.getFindCombo().setFocus();
dialog.setFindText("line");
dialog.simulateKeyboardInteractionInFindInputField(SWT.CR, false);
- waitForFocus(dialog.getFindCombo()::isFocusControl, testName.getMethodName());
+ waitForFocus(dialog.getFindCombo()::isFocusControl, testInfo.getTestMethod().get().getName());
Button wrapCheckBox= dialog.getButtonForSearchOption(SearchOptions.WRAP);
Button globalRadioButton= dialog.getButtonForSearchOption(SearchOptions.GLOBAL);
wrapCheckBox.setFocus();
dialog.simulateKeyboardInteractionInFindInputField(SWT.CR, false);
- waitForFocus(wrapCheckBox::isFocusControl, testName.getMethodName());
+ waitForFocus(wrapCheckBox::isFocusControl, testInfo.getTestMethod().get().getName());
globalRadioButton.setFocus();
dialog.simulateKeyboardInteractionInFindInputField(SWT.CR, false);
- waitForFocus(globalRadioButton::isFocusControl, testName.getMethodName());
+ waitForFocus(globalRadioButton::isFocusControl, testInfo.getTestMethod().get().getName());
}
@Test
public void testFocusNotChangedWhenButtonMnemonicPressed() {
- assumeFalse("Mac does not support mnemonics", Util.isMac());
+ assumeFalse(Util.isMac(), "Mac does not support mnemonics");
initializeTextViewerWithFindReplaceUI("");
DialogAccess dialog= getDialog();
@@ -97,20 +97,20 @@ public void testFocusNotChangedWhenButtonMnemonicPressed() {
event.character= 'n';
event.doit= false;
wrapCheckBox.traverse(SWT.TRAVERSE_MNEMONIC, event);
- waitForFocus(wrapCheckBox::isFocusControl, testName.getMethodName());
+ waitForFocus(wrapCheckBox::isFocusControl, testInfo.getTestMethod().get().getName());
Button globalRadioButton= dialog.getButtonForSearchOption(SearchOptions.GLOBAL);
globalRadioButton.setFocus();
event.detail= SWT.TRAVERSE_MNEMONIC;
event.doit= false;
globalRadioButton.traverse(SWT.TRAVERSE_MNEMONIC, event);
- waitForFocus(globalRadioButton::isFocusControl, testName.getMethodName());
+ waitForFocus(globalRadioButton::isFocusControl, testInfo.getTestMethod().get().getName());
event.detail= SWT.TRAVERSE_MNEMONIC;
event.character= 'r';
event.doit= false;
globalRadioButton.traverse(SWT.TRAVERSE_MNEMONIC, event);
- waitForFocus(globalRadioButton::isFocusControl, testName.getMethodName());
+ waitForFocus(globalRadioButton::isFocusControl, testInfo.getTestMethod().get().getName());
}
@Test
@@ -232,4 +232,4 @@ public void testReplaceButtonEnabledWithRegexSearched() {
assertTrue(dialog.getReplaceButton().isEnabled());
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java
index c528d63a50d..cdbeb0aad1c 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java
@@ -14,18 +14,18 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.core.runtime.AssertionFailedException;
@@ -47,7 +47,7 @@ public class HippieCompletionTest {
IDocument[] documents;
private HippieCompletionEngine fEngine;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
documents= new IDocument[5];
documents[0]= new Document("""
@@ -149,25 +149,25 @@ public static void main(String[] args) {
public void testSearchBackwards1() throws BadLocationException {
List list= fEngine.getCompletionsBackwards(documents[0],
"pri", documents[0].get().indexOf("println") + 10);
- assertEquals(list.size(), 2);
- assertEquals(list.get(0), "ntln");
- assertEquals(list.get(1), "nt");
+ assertEquals(2, list.size());
+ assertEquals("ntln", list.get(0));
+ assertEquals("nt", list.get(1));
list= fEngine.getCompletionsBackwards(documents[0],
"pri", documents[0].getLength());
- assertEquals(list.size(), 3);
- assertEquals(list.get(0), "nting");
- assertEquals(list.get(1), "ntln");
- assertEquals(list.get(2), "nt");
+ assertEquals(3, list.size());
+ assertEquals("nting", list.get(0));
+ assertEquals("ntln", list.get(1));
+ assertEquals("nt", list.get(2));
list= fEngine.getCompletionsBackwards(documents[0],
"pri", documents[0].get().indexOf("println") + 1);
- assertEquals(list.size(), 1);
- assertEquals(list.get(0), "nt");
+ assertEquals(1, list.size());
+ assertEquals("nt", list.get(0));
list= fEngine.getCompletionsBackwards(documents[0],
"pa", 2);
- assertEquals(list.size(), 0);
+ assertEquals(0, list.size());
}
@@ -190,54 +190,54 @@ public void testSearchBackwards2() throws BadLocationException {
public void testSearchBackwards3() throws BadLocationException {
List list= fEngine.getCompletionsBackwards(documents[1],
"test", documents[1].getLength());
- assertEquals("Number of backwards suggestions does not match", 2, list.size());
+ assertEquals(2, list.size(), "Number of backwards suggestions does not match");
list= fEngine.getCompletionsBackwards(documents[1],
"tests", documents[1].getLength());
- assertEquals("Number of backwards suggestions does not match", 1, list.size());
+ assertEquals(1, list.size(), "Number of backwards suggestions does not match");
list= fEngine.getCompletionsBackwards(documents[1],
"test", documents[1].getLength() - 1);
- assertEquals("Number of backwards suggestions does not match", 1, list.size());
+ assertEquals(1, list.size(), "Number of backwards suggestions does not match");
}
@Test
public void testSearch() throws BadLocationException {
ArrayList docsList= new ArrayList<>(Arrays.asList(this.documents));
List result= createSuggestions("te", docsList);
- assertEquals("Number of completions does not match", 15, result.size());
+ assertEquals(15, result.size(), "Number of completions does not match");
result= fEngine.makeUnique(result);
- assertEquals("Number of completions does not match", 7, result.size());
+ assertEquals(7, result.size(), "Number of completions does not match");
result= createSuggestions("Plug", docsList);
- assertEquals("Number of completions does not match", 2, result.size());
+ assertEquals(2, result.size(), "Number of completions does not match");
result= createSuggestions("p", docsList);
- assertEquals("Number of completions does not match", 23, result.size());
+ assertEquals(23, result.size(), "Number of completions does not match");
result= fEngine.makeUnique(result);
- assertEquals("Number of completions does not match", 10, result.size());
- assertEquals("Incorrect completion", "ackage", result.get(0));
- assertEquals("Incorrect completion", "rint", result.get(1));
- assertEquals("Incorrect completion", "ublic", result.get(2));
- assertEquals("Incorrect completion", "rintln", result.get(3));
- assertEquals("Incorrect completion", "rinting", result.get(4));
- assertEquals("Incorrect completion", "lugin", result.get(5));
- assertEquals("Incorrect completion", "rovider", result.get(6));
- assertEquals("Incorrect completion", "roviderName", result.get(7));
- assertEquals("Incorrect completion", "rogram", result.get(8));
- assertEquals("Incorrect completion", "roperties", result.get(9));
+ assertEquals(10, result.size(), "Number of completions does not match");
+ assertEquals("ackage", result.get(0), "Incorrect completion");
+ assertEquals("rint", result.get(1), "Incorrect completion");
+ assertEquals("ublic", result.get(2), "Incorrect completion");
+ assertEquals("rintln", result.get(3), "Incorrect completion");
+ assertEquals("rinting", result.get(4), "Incorrect completion");
+ assertEquals("lugin", result.get(5), "Incorrect completion");
+ assertEquals("rovider", result.get(6), "Incorrect completion");
+ assertEquals("roviderName", result.get(7), "Incorrect completion");
+ assertEquals("rogram", result.get(8), "Incorrect completion");
+ assertEquals("roperties", result.get(9), "Incorrect completion");
}
@Test
public void testSearch2() throws BadLocationException {
ArrayList docsList= new ArrayList<>(Arrays.asList(this.documents));
List result= createSuggestions("printe", docsList);
- assertEquals("Number of completions does not match", 0, result.size());
+ assertEquals(0, result.size(), "Number of completions does not match");
result= createSuggestions("s", docsList);
- assertEquals("Number of completions does not match", 8, result.size());
+ assertEquals(8, result.size(), "Number of completions does not match");
result= createSuggestions("pack", documents[0]);
- assertEquals("Number of completions does not match", 1, result.size());
+ assertEquals(1, result.size(), "Number of completions does not match");
}
@Test
@@ -283,56 +283,56 @@ public void testForwardSearchInternational() throws BadLocationException {
public void testPrefix() throws BadLocationException {
String prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("testing") + 3);
- assertEquals(prefix, "tes");
+ assertEquals("tes", prefix);
prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("public") + 4);
- assertEquals(prefix, "publ");
+ assertEquals("publ", prefix);
prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("println") + 7);
- assertEquals(prefix, "println");
+ assertEquals("println", prefix);
prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("println") + 8);
- assertEquals(prefix, null);
+ assertEquals(null, prefix);
prefix= fEngine.getPrefixString(documents[1], 3);
- assertEquals(prefix, "Thi");
+ assertEquals("Thi", prefix);
prefix= fEngine.getPrefixString(documents[1], 0);
- assertEquals(prefix, null);
+ assertEquals(null, prefix);
prefix= fEngine.getPrefixString(documents[1], documents[1].getLength());
- assertEquals(prefix, "tests");
+ assertEquals("tests", prefix);
prefix= fEngine.getPrefixString(documents[3],
documents[3].get().indexOf("Copyright") - 2);
- assertEquals(prefix, null);
+ assertEquals(null, prefix);
prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("IDE") + 2);
- assertEquals(prefix, "ID");
+ assertEquals("ID", prefix);
prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("$arabic\u20ACDigits") + 8);
- assertEquals(prefix, "$arabic\u20AC");
+ assertEquals("$arabic\u20AC", prefix);
prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("$arabic\u20AAWord") + 8);
- assertEquals(prefix, "$arabic\u20AA");
+ assertEquals("$arabic\u20AA", prefix);
prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("\u00A3\u0661\u0662\u0663") + 3);
- assertEquals(prefix, "\u00A3\u0661\u0662");
+ assertEquals("\u00A3\u0661\u0662", prefix);
prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("a\u0300\u0301b") + 3);
- assertEquals(prefix, "a\u0300\u0301");
+ assertEquals("a\u0300\u0301", prefix);
prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("\u0667\u0668\u0669\u0660") + 2);
- assertEquals(prefix, "\u0667\u0668");
+ assertEquals("\u0667\u0668", prefix);
}
@Test
@@ -340,66 +340,66 @@ public void testInternational() throws BadLocationException {
IDocument intlDoc= documents[4];
List result= createSuggestions("\u05D4", intlDoc); // hebrew letter heh
- assertEquals("Number of completions does not match", 4, result.size());
- assertEquals(result.get(0), "\u05DE\u05D7\u05DC\u05E7\u05D4");
- assertEquals(result.get(1), "\u05D6\u05D5");
- assertEquals(result.get(2), "\u05D4\u05E9\u05DC\u05DE\u05D5\u05EA");
- assertEquals(result.get(3), "\u05D4\u05E9");
+ assertEquals(4, result.size(), "Number of completions does not match");
+ assertEquals("\u05DE\u05D7\u05DC\u05E7\u05D4", result.get(0));
+ assertEquals("\u05D6\u05D5", result.get(1));
+ assertEquals("\u05D4\u05E9\u05DC\u05DE\u05D5\u05EA", result.get(2));
+ assertEquals("\u05D4\u05E9", result.get(3));
result= createSuggestions("\u0661", intlDoc); // arabic digit "1"
- assertEquals("Number of completions does not match", 1, result.size());
- assertEquals(result.get(0), "\u0662\u0663\u0664\u0665\u0666");
+ assertEquals(1, result.size(), "Number of completions does not match");
+ assertEquals("\u0662\u0663\u0664\u0665\u0666", result.get(0));
result= createSuggestions("\u0628\u064E", intlDoc); // arabic letter bah and fatha
- assertEquals("Number of completions does not match", 1, result.size());
- assertEquals(result.get(0), "\u0627\u0628\u0650");
+ assertEquals(1, result.size(), "Number of completions does not match");
+ assertEquals("\u0627\u0628\u0650", result.get(0));
result= createSuggestions("\u0628", intlDoc); // arabic letter bah
- assertEquals("Number of completions does not match", 2, result.size());
- assertEquals(result.get(0), "\u064E\u0627\u0628\u0650");
- assertEquals(result.get(1), "\u0627\u0628");
+ assertEquals(2, result.size(), "Number of completions does not match");
+ assertEquals("\u064E\u0627\u0628\u0650", result.get(0));
+ assertEquals("\u0627\u0628", result.get(1));
result= createSuggestions("$ara", intlDoc);
- assertEquals("Number of completions does not match", 2, result.size());
- assertEquals(result.get(0), "bic\u20ACDigits");
- assertEquals(result.get(1), "bic\u20AAWord");
+ assertEquals(2, result.size(), "Number of completions does not match");
+ assertEquals("bic\u20ACDigits", result.get(0));
+ assertEquals("bic\u20AAWord", result.get(1));
result= createSuggestions("\u0441\u0430", intlDoc); // russian letters "s" and "a"
- assertEquals("Number of completions does not match", 2, result.size());
- assertEquals(result.get(0), "\u043C\u044B\u0439");
- assertEquals(result.get(1), "\u043C");
+ assertEquals(2, result.size(), "Number of completions does not match");
+ assertEquals("\u043C\u044B\u0439", result.get(0));
+ assertEquals("\u043C", result.get(1));
result= createSuggestions("\u05D1\u05D5", intlDoc); // hebrew letters bet and vav
- assertEquals("Number of completions does not match", 2, result.size());
- assertEquals(result.get(0), "\u05D3\u05E7\u05EA");
- assertEquals(result.get(1), "\u05D3\u05E7");
+ assertEquals(2, result.size(), "Number of completions does not match");
+ assertEquals("\u05D3\u05E7\u05EA", result.get(0));
+ assertEquals("\u05D3\u05E7", result.get(1));
result= createSuggestions("a", intlDoc);
- assertEquals("Number of completions does not match", 4, result.size());
- assertEquals(result.get(0), "n");
- assertEquals(result.get(1), "rabic");
- assertEquals(result.get(2), "rgs");
- assertEquals(result.get(3), "\u0300\u0301b");
+ assertEquals(4, result.size(), "Number of completions does not match");
+ assertEquals("n", result.get(0));
+ assertEquals("rabic", result.get(1));
+ assertEquals("rgs", result.get(2));
+ assertEquals("\u0300\u0301b", result.get(3));
result= createSuggestions("\u20AA", intlDoc); // israeli currency (shekel)
- assertEquals("Number of completions does not match", 1, result.size());
- assertEquals(result.get(0), "129");
+ assertEquals(1, result.size(), "Number of completions does not match");
+ assertEquals("129", result.get(0));
result= createSuggestions("\u20A3", intlDoc); // french currency (frank)
- assertEquals("Number of completions does not match", 2, result.size());
- assertEquals(result.get(0), "1");
- assertEquals(result.get(1), "1");
+ assertEquals(2, result.size(), "Number of completions does not match");
+ assertEquals("1", result.get(0));
+ assertEquals("1", result.get(1));
result= createSuggestions("\u044D", intlDoc); // russial letter "hard e"
- assertEquals("Number of completions does not match", 2, result.size());
- assertEquals(result.get(0), "\u0442\u043E");
- assertEquals(result.get(1), "\u0442");
+ assertEquals(2, result.size(), "Number of completions does not match");
+ assertEquals("\u0442\u043E", result.get(0));
+ assertEquals("\u0442", result.get(1));
result= createSuggestions("\u00A3", intlDoc); // pound currency sign
- assertEquals("Number of completions does not match", 1, result.size());
- assertEquals(result.get(0), "\u0661\u0662\u0663");
+ assertEquals(1, result.size(), "Number of completions does not match");
+ assertEquals("\u0661\u0662\u0663", result.get(0));
result= createSuggestions("\u00A5", intlDoc); // yen currency sign
- assertEquals("Number of completions does not match", 0, result.size());
+ assertEquals(0, result.size(), "Number of completions does not match");
}
@Test
@@ -408,14 +408,14 @@ public void testInternationalBackwards() throws BadLocationException {
List list= fEngine.getCompletionsBackwards(intlDoc,
"\u043B\u0443", intlDoc.get().indexOf("129"));
assertEquals(2, list.size());
- assertEquals(list.get(0), "\u0447\u0448");
- assertEquals(list.get(1), "\u0447\u0448\u0438\u0439");
+ assertEquals("\u0447\u0448", list.get(0));
+ assertEquals("\u0447\u0448\u0438\u0439", list.get(1));
list= fEngine.getCompletionsBackwards(intlDoc,
"\u05DE", intlDoc.get().lastIndexOf('+'));
assertEquals(2, list.size());
- assertEquals(list.get(0), "\u05D7");
- assertEquals(list.get(1), "\u05E0\u05D2\u05E0\u05D5\u05DF");
+ assertEquals("\u05D7", list.get(0));
+ assertEquals("\u05E0\u05D2\u05E0\u05D5\u05DF", list.get(1));
list= fEngine.getCompletionsBackwards(intlDoc,
"\u0667", intlDoc.get().indexOf("\u2021\u0667") + 1);
@@ -424,7 +424,7 @@ public void testInternationalBackwards() throws BadLocationException {
list= fEngine.getCompletionsBackwards(intlDoc,
"\u0628", intlDoc.get().lastIndexOf("\u0628"));
assertEquals(1, list.size());
- assertEquals(list.get(0), "\u064E\u0627\u0628\u0650");
+ assertEquals("\u064E\u0627\u0628\u0650", list.get(0));
}
@@ -508,7 +508,7 @@ public void testCompletionState() throws Exception {
@Test
public void testIteration() throws Exception {
//Check only with current document
- IDocument openDocument= new Document("" +
+ IDocument openDocument= new Document ("" +
"bar\n" +
"bar1\n" +
"bar2\n" +
@@ -523,7 +523,7 @@ public void testIteration() throws Exception {
//Check with 2 documents
List otherDocuments= new ArrayList<>();
- otherDocuments.add(new Document("" +
+ otherDocuments.add(new Document ("" +
"bar3\n" +
"bar4\n" +
""));
@@ -578,4 +578,4 @@ private List createSuggestions(String prefix, List docsList)
return results;
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java
index 793ed327921..f1eb232d74f 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java
@@ -16,9 +16,8 @@
import java.io.File;
import java.io.PrintStream;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
@@ -39,17 +38,14 @@
public class ScreenshotTest {
- @Rule
- public TestName testName = new TestName();
-
@Test
- public void testScreenshot() throws Exception {
- String screenshot= takeScreenshot(ScreenshotTest.class, testName.getMethodName(), System.out);
+ public void testScreenshot(TestInfo testInfo) throws Exception {
+ String screenshot= takeScreenshot(ScreenshotTest.class, testInfo.getTestMethod().get().getName(), System.out);
new File(screenshot).delete();
}
@Test
- public void testWindowsTaskManagerScreenshots() throws Exception {
+ public void testWindowsTaskManagerScreenshots(TestInfo testInfo) throws Exception {
if (! Util.isWindows())
return;
@@ -74,7 +70,7 @@ public void testWindowsTaskManagerScreenshots() throws Exception {
System.out.println("* CTRL up " + display.post(event));
runEventQueue();
- String screenshot1= takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 2, System.out);
+ String screenshot1= takeScreenshot(ScreenshotTest.class, testInfo.getTestMethod().get().getName() + 2, System.out);
event.type= SWT.KeyDown;
event.character= SWT.ESC;
@@ -84,7 +80,7 @@ public void testWindowsTaskManagerScreenshots() throws Exception {
System.out.println("* ESC up " + display.post(event));
runEventQueue();
- String screenshot2= takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 3, System.out);
+ String screenshot2= takeScreenshot(ScreenshotTest.class, testInfo.getTestMethod().get().getName() + 3, System.out);
new File(screenshot1).delete();
new File(screenshot2).delete();
}
@@ -194,4 +190,4 @@ private static void runEventQueue() {
}
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java
index 67c81bee7b9..31c6fd31157 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java
@@ -13,16 +13,16 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Random;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
import org.eclipse.ui.internal.texteditor.HistoryTracker;
@@ -31,7 +31,7 @@
*
* @since 3.1
*/
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@TestMethodOrder(MethodOrderer.MethodName.class)
public class TextEditorPluginTest {
Random rand = new Random(55); //pseudo-random for repeatability
@@ -379,4 +379,4 @@ private void goBackLinear(HistoryTracker history, boolean shouldMove) {
assertEquals(latest, prior);
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java
index 493989e30b9..bc126647159 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java
@@ -10,15 +10,15 @@
*
* Contributors:
* Pierre-Yves Bigourdan - initial API and implementation
- *******************************************************************************/
+ ******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
@@ -42,7 +42,7 @@ public class TextViewerDeleteLineTargetTest {
private Shell parentShell;
private TextViewerDeleteLineTarget underTest;
- @Before
+ @BeforeEach
public void setUp() {
document= new Document("first line\n" +
"\n" +
@@ -55,7 +55,7 @@ public void setUp() {
underTest= new TextViewerDeleteLineTarget(textViewer);
}
- @After
+ @AfterEach
public void tearDown() {
if (parentShell != null) {
parentShell.dispose();
@@ -115,4 +115,4 @@ public void testThrowsExceptionWithUnsupportedDeleteLineActionType() throws Exce
assertThrows(IllegalArgumentException.class, () -> underTest.deleteLine(document, 0, 0, IAction.AS_RADIO_BUTTON, false));
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java
index b3a945594da..a6e83f30a38 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java
@@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests.minimap;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -77,20 +77,20 @@ public T getAdapter(Class required) {
public void createNoneMinimapPage() {
ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.None);
MinimapPage page= MinimapPage.createMinimapPage(textEditor);
- Assert.assertNull(page);
+ Assertions.assertNull(page);
}
@Test
public void createMinimapPageWithITextViewerAdapter() {
ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.ITextViewer);
MinimapPage page= MinimapPage.createMinimapPage(textEditor);
- Assert.assertNotNull(page);
+ Assertions.assertNotNull(page);
}
@Test
public void createMinimapPageWithITextOperationTargetAdapter() {
ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.ITextOperationTarget);
MinimapPage page= MinimapPage.createMinimapPage(textEditor);
- Assert.assertNotNull(page);
+ Assertions.assertNotNull(page);
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java
index 7044e9550a0..da8c8f80df5 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java
@@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests.minimap;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
@@ -53,7 +53,7 @@ public class MinimapWidgetTest {
private StyledText minimapStyledText;
- @Before
+ @BeforeEach
public void createMinimap() {
minimapParent= new Shell();
editorViewer= new TextViewer(minimapParent, SWT.NONE);
@@ -65,7 +65,7 @@ public void createMinimap() {
}
- @After
+ @AfterEach
public void tearDownMinimap() {
if (minimapParent != null) {
minimapParent.dispose();
@@ -76,10 +76,10 @@ public void tearDownMinimap() {
@Test
public void testMinimapContent() {
editorStyledText.setText("abcd");
- Assert.assertEquals("abcd", minimapStyledText.getText());
+ Assertions.assertEquals("abcd", minimapStyledText.getText());
editorStyledText.replaceTextRange(1, 0, "ABCD");
- Assert.assertEquals("aABCDbcd", minimapStyledText.getText());
+ Assertions.assertEquals("aABCDbcd", minimapStyledText.getText());
}
@Test
@@ -90,7 +90,7 @@ public void testMinimapSetStyles() {
StyleRange[] ranges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null) };
editorStyledText.setStyleRanges(ranges);
// Styles of minimap doesn't changed
- Assert.assertArrayEquals(orginalMinimapStyles, minimapStyledText.getStyleRanges());
+ Assertions.assertArrayEquals(orginalMinimapStyles, minimapStyledText.getStyleRanges());
}
@Test
@@ -103,7 +103,7 @@ public void testMinimapSetStylesWithTextPresentation() {
presentation.mergeStyleRanges(ranges);
editorViewer.changeTextPresentation(presentation, false);
StyleRange[] expectedRanges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null) };
- Assert.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges());
+ Assertions.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges());
ranges= new StyleRange[] { new StyleRange(1, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_RED), null) };
presentation= new TextPresentation();
@@ -111,6 +111,6 @@ public void testMinimapSetStylesWithTextPresentation() {
editorViewer.changeTextPresentation(presentation, false);
expectedRanges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null),
new StyleRange(1, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_RED), null) };
- Assert.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges());
+ Assertions.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges());
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java
index a74c27a2d7b..dcb6d49f9da 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java
@@ -13,15 +13,15 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests.revisions;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Date;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.eclipse.swt.graphics.RGB;
@@ -62,7 +62,7 @@ public Date getDate() {
private Revision fRevision;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
fRevision= new TestRevision();
}
@@ -411,4 +411,4 @@ public void testHunkInBetween() throws Exception {
RangeUtil.assertEqualRanges(new LineRange(12, 3), new LineRange(19, 2), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 9), r.getAdjustedCoverage());
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java
index 3fa96c95925..726e47ee61a 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java
@@ -13,9 +13,9 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests.revisions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.jface.internal.text.revisions.Hunk;
import org.eclipse.jface.internal.text.revisions.HunkComputer;
@@ -246,4 +246,4 @@ private void assertHunks(int[] diffInfo, int[] expected) {
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java
index 6722ddd7f9a..195da2bfeb0 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java
@@ -13,11 +13,11 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests.revisions;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.jface.internal.text.revisions.LineIndexOutOfBoundsException;
import org.eclipse.jface.internal.text.revisions.Range;
@@ -398,4 +398,4 @@ private static void assertConsistency(Range r) {
assertEquals(r.start() + r.length(), r.end());
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java
index 836302634a2..b8bdeebe36c 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java
@@ -13,18 +13,18 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests.revisions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.junit.Assert;
-
import org.eclipse.jface.internal.text.revisions.Range;
import org.eclipse.jface.text.source.ILineRange;
-class RangeUtil extends Assert {
+class RangeUtil {
private RangeUtil() {}
static void assertEqualRange(ILineRange expected, ILineRange actual) {
@@ -62,4 +62,4 @@ static void assertEqualRanges(List expected, List actual) {
assertEqualRange(r1, r2);
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java
index 85285fb8be1..7872db7cbee 100644
--- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java
+++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java
@@ -13,14 +13,17 @@
*******************************************************************************/
package org.eclipse.ui.workbench.texteditor.tests.rulers;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.ui.internal.texteditor.rulers.DAG;
@@ -136,4 +139,4 @@ public void testDag() throws Exception {
assertTrue(fDag.getChildren(C).isEmpty());
assertTrue(fDag.getChildren(D).isEmpty());
}
-}
+}
\ No newline at end of file