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 @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.ui.tests.internal;

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 java.util.ArrayList;
import java.util.List;
Expand All @@ -23,22 +23,20 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.registry.EditorDescriptor;
import org.eclipse.ui.internal.registry.FileEditorMapping;
import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;

@Ignore
import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

@Disabled
@ExtendWith(CloseTestWindowsExtension.class)
public class FileEditorMappingTest {

@Rule
public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule();

private EditorDescriptor textEditor;
private EditorDescriptor pdeEditor;

@Before
@BeforeEach
public final void setUp() throws Exception {
textEditor = (EditorDescriptor) IDE.getEditorDescriptor("test.txt");
pdeEditor = (EditorDescriptor) IDE.getEditorDescriptor("plugin.xml");
Expand All @@ -53,8 +51,7 @@ public void testEquals() {
assertEquals(textEditor, mappingA.getEditors()[0]);

FileEditorMapping mappingB = new FileEditorMapping("txt");
assertFalse("No editor set for B, should not be equal", mappingA
.equals(mappingB));
assertFalse(mappingA.equals(mappingB), "No editor set for B, should not be equal");

mappingA.addEditor(pdeEditor);
mappingB.addEditor(textEditor);
Expand All @@ -70,8 +67,7 @@ public void testEquals() {

assertEquals(textEditor, mappingA.getDefaultEditor());
assertEquals(pdeEditor, mappingB.getDefaultEditor());
assertFalse("Identical except the default editor, should not be equal",
mappingA.equals(mappingB));
assertFalse(mappingA.equals(mappingB), "Identical except the default editor, should not be equal");
}

@Test
Expand All @@ -97,8 +93,7 @@ public void testEquals2() {
mappingA.setDefaultEditors(defaultA);
mappingB.setDefaultEditors(defaultB);

assertFalse("Identical except the default editor, should not be equal",
mappingA.equals(mappingB));
assertFalse(mappingA.equals(mappingB), "Identical except the default editor, should not be equal");
}

@Test
Expand All @@ -110,8 +105,7 @@ public void testHashCode() {
assertEquals(textEditor, mappingA.getEditors()[0]);

FileEditorMapping mappingB = new FileEditorMapping("txt");
assertFalse("No editor set for B, should not be equal", mappingA
.hashCode() == mappingB.hashCode());
assertFalse(mappingA.hashCode() == mappingB.hashCode(), "No editor set for B, should not be equal");

mappingA.addEditor(pdeEditor);
mappingB.addEditor(textEditor);
Expand All @@ -127,8 +121,7 @@ public void testHashCode() {

assertEquals(textEditor, mappingA.getDefaultEditor());
assertEquals(pdeEditor, mappingB.getDefaultEditor());
assertFalse("Identical except the default editor, should not be equal",
mappingA.hashCode() == mappingB.hashCode());
assertFalse(mappingA.hashCode() == mappingB.hashCode(), "Identical except the default editor, should not be equal");
}

@Test
Expand All @@ -154,8 +147,7 @@ public void testHashCode2() {
mappingA.setDefaultEditors(defaultA);
mappingB.setDefaultEditors(defaultB);

assertFalse("Identical except the default editor, should not be equal",
mappingA.hashCode() == mappingB.hashCode());
assertFalse(mappingA.hashCode() == mappingB.hashCode(), "Identical except the default editor, should not be equal");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

import static org.eclipse.ui.SaveablesLifecycleEvent.POST_CLOSE;
import static org.eclipse.ui.SaveablesLifecycleEvent.POST_OPEN;
import static org.junit.Assert.assertEquals;
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.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Arrays;
import java.util.Collection;
Expand All @@ -40,19 +40,17 @@
import org.eclipse.ui.Saveable;
import org.eclipse.ui.SaveablesLifecycleEvent;
import org.eclipse.ui.internal.SaveablesList;
import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

/**
* @since 3.5
*/
@ExtendWith(CloseTestWindowsExtension.class)
public class SaveablesListTest {

@Rule
public final CloseTestWindowsRule closeTestWindowsRule = new CloseTestWindowsRule();

static class GoodSaveable extends Saveable {

Object source;
Expand Down Expand Up @@ -187,7 +185,7 @@ protected Map<Saveable, Integer> getModelRefCounts() {
private DummyPart part2;
private DummyPart part3;

@Before
@BeforeEach
public final void setUp() throws Exception {
slist = new SaveablesListForTest();
source = new Object();
Expand Down
Loading