Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

package org.eclipse.ui.tests.activities;

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 java.util.regex.Pattern;

import org.eclipse.ui.internal.activities.PatternUtil;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test for:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.ui.tests.activities;

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.HashMap;
import java.util.HashSet;
Expand All @@ -40,9 +40,9 @@
import org.eclipse.ui.contexts.IContextActivation;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.services.IEvaluationService;
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;

/**
* Tests various utility methods on WorkbenchActivityHelper as well as other misc. activities functionality.
Expand Down Expand Up @@ -607,12 +607,12 @@ public void testSetEnabledExpressionActivity() {
evalService.removeSourceProvider(testSourceProvider);
}

@Before
@BeforeEach
public void setUp() throws Exception {
rememberedSet = getActivityManager().getEnabledActivityIds();
}

@After
@AfterEach
public void tearDown() throws Exception {
PlatformUI.getWorkbench().getActivitySupport().setEnabledActivityIds(
rememberedSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
*******************************************************************************/
package org.eclipse.ui.tests.api;

import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IFileEditorMapping;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.tests.harness.util.ArrayUtil;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class IEditorDescriptorTest {
IEditorDescriptor[] fEditors;

@Before
@BeforeEach
public void setUp() {
IFileEditorMapping mapping = (IFileEditorMapping) ArrayUtil
.pickRandom(PlatformUI.getWorkbench().getEditorRegistry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
*******************************************************************************/
package org.eclipse.ui.tests.api;

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.ui.IEditorDescriptor;
import org.eclipse.ui.IFileEditorMapping;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.tests.harness.util.ArrayUtil;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

public class IFileEditorMappingTest {
private IFileEditorMapping[] fMappings;

@Before
@BeforeEach
public void setUp() {
fMappings = PlatformUI.getWorkbench().getEditorRegistry()
.getFileEditorMappings();
Expand Down Expand Up @@ -78,7 +78,7 @@ public void testGetImageDescriptor() throws Throwable {

//how do i set the default editor?
@Test
@Ignore
@Disabled
public void testGetDefaultEditor() throws Throwable {
for (IFileEditorMapping fMapping : fMappings) {
assertNotNull(fMapping.getDefaultEditor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
*******************************************************************************/
package org.eclipse.ui.tests.api;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.PlatformUI;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class IPerspectiveDescriptorTest {

private IPerspectiveDescriptor[] fPerspectives;

@Before
@BeforeEach
public void setUp() {
fPerspectives = PlatformUI
.getWorkbench().getPerspectiveRegistry().getPerspectives();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*******************************************************************************/
package org.eclipse.ui.tests.api;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.io.IOException;
import java.io.Reader;
Expand All @@ -25,7 +25,7 @@
import org.eclipse.ui.IMemento;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.XMLMemento;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Testing XMLMemento (see bug 93262). Emphasis is on ensuring that the 3.1
Expand All @@ -52,8 +52,9 @@ public class XMLMementoTest {
@Test
public void testCreateReadRootReaderExceptionCases() {
assertThrows(WorkbenchException.class, () -> XMLMemento.createReadRoot(new StringReader("Invalid format")));
assertThrows("no exception even though there is noe element", WorkbenchException.class,
() -> XMLMemento.createReadRoot(new StringReader("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>")));
assertThrows(WorkbenchException.class,
() -> XMLMemento.createReadRoot(new StringReader("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>")),
"no exception even though there is noe element");
assertThrows(WorkbenchException.class, () ->
XMLMemento.createReadRoot(new Reader() {

Expand Down Expand Up @@ -479,7 +480,7 @@ public void testIllegalKeys() {

for (final String key : illegalKeys) {
XMLMemento memento = XMLMemento.createWriteRoot("foo");
assertThrows("should fail with illegal key", Exception.class, () -> memento.putString(key, "some string"));
assertThrows(Exception.class, () -> memento.putString(key, "some string"), "should fail with illegal key");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*******************************************************************************/
package org.eclipse.ui.tests.commands;

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.text.MessageFormat;
import java.util.ResourceBundle;
Expand All @@ -26,8 +26,8 @@
import org.eclipse.ui.statushandlers.StatusAdapter;
import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.ui.tests.statushandlers.TestStatusHandler;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
* A tests whether is active will log an exception if the command is not
Expand All @@ -50,7 +50,7 @@ public final class Bug73756Test {

private static String PLUGIN_ID = "org.eclipse.jface";

@Before
@BeforeEach
public void doTearDown() throws Exception {
TestStatusHandler.uninstall();
}
Expand All @@ -77,7 +77,7 @@ public final void testUndefinedCommandIsActiveLogged() throws Exception {
* Checks whether the last handled status is correct
*/
private void assertStatusAdapter(StatusAdapter statusAdapter) {
assertNotNull("A warning should have been logged.", statusAdapter);
assertNotNull(statusAdapter, "A warning should have been logged.");
IStatus status = statusAdapter.getStatus();
assertEquals(status.getSeverity(), SEVERITY);
assertEquals(status.getPlugin(), PLUGIN_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.ui.tests.commands;

import static org.junit.Assert.assertSame;
import static org.junit.jupiter.api.Assertions.assertSame;

import org.eclipse.core.commands.Category;
import org.eclipse.core.commands.Command;
Expand All @@ -23,7 +23,7 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IExecutionListener;
import org.eclipse.core.commands.NotHandledException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Tests some of the API on command manager.
Expand Down Expand Up @@ -102,13 +102,13 @@ public final void testExecutionListener() {
exception = e;
}

assertSame("Should have received a pre-execute event for the correct command", commandId,
listener.preExecuteId);
assertSame("Should have received a pre-execute event with the correct event", event, listener.preExecuteEvent);
assertSame("Should have received a not-handled event for the correct command", commandId,
listener.notHandledId);
assertSame("Should have received a not-handled event with the correct exception", exception,
listener.notHandledException);
assertSame(commandId,
listener.preExecuteId, "Should have received a pre-execute event for the correct command");
assertSame(event, listener.preExecuteEvent, "Should have received a pre-execute event with the correct event");
assertSame(commandId,
listener.notHandledId, "Should have received a not-handled event for the correct command");
assertSame(exception,
listener.notHandledException, "Should have received a not-handled event with the correct exception");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
*******************************************************************************/
package org.eclipse.ui.tests.commands;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
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.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.concurrent.atomic.AtomicReference;

Expand All @@ -34,7 +34,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.handlers.IHandlerService;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class CommandParameterTypeTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.ui.tests.commands;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
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.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Map;

Expand All @@ -26,7 +26,7 @@
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test serialization and deserialization of ParameterizedCommands. See <a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.eclipse.ui.tests.commands;

import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandImageService;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* @since 3.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.ui.tests.commands;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.Command;
Expand All @@ -28,7 +28,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.handlers.IHandlerService;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Tests the new help context identifier support on commands and handlers.
Expand Down Expand Up @@ -63,9 +63,8 @@ public final void testHelpContextId() throws NotDefinedException {

// At first, the help context id should be the handler.
helpContextId = commandService.getHelpContextId(COMMAND_ID);
assertEquals(
"The initial help context id should be that of the handler",
HANDLER_HELP_ID, helpContextId);
assertEquals(HANDLER_HELP_ID, helpContextId,
"The initial help context id should be that of the handler");

// Retract the handler help context id by creating a more specific handler
handlerService.activateHandler(COMMAND_ID, new AbstractHandler() {
Expand All @@ -86,17 +85,15 @@ public EvaluationResult evaluate(IEvaluationContext context) {
}
});
helpContextId = commandService.getHelpContextId(COMMAND_ID);
assertEquals("The help context id should now be that of the command",
COMMAND_HELP_ID, helpContextId);
assertEquals(COMMAND_HELP_ID, helpContextId, "The help context id should now be that of the command");

// Now re-define the command with a different help context id.
final Command command = commandService.getCommand(COMMAND_ID);
command.undefine();
command.define("New Name", null, commandService.getCategory(null),
null, null, NEW_HELP_ID);
helpContextId = commandService.getHelpContextId(COMMAND_ID);
assertEquals("The help context id should now be the new id",
NEW_HELP_ID, helpContextId);
assertEquals(NEW_HELP_ID, helpContextId, "The help context id should now be the new id");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.operation.IThreadListener;
import org.eclipse.ui.PlatformUI;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Tests IJobManger#transferRule in conjunction with ModalContext.run.
Expand Down
Loading
Loading