diff --git a/tests/org.eclipse.text.quicksearch.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.text.quicksearch.tests/META-INF/MANIFEST.MF index 2a73070cd7e..0a788b49508 100644 --- a/tests/org.eclipse.text.quicksearch.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.text.quicksearch.tests/META-INF/MANIFEST.MF @@ -2,14 +2,17 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.text.quicksearch.tests -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 1.3.100.qualifier Require-Bundle: org.eclipse.core.runtime, org.eclipse.text.quicksearch;bundle-version="1.0.300", org.eclipse.core.resources, - org.junit;bundle-version="4.8.0", org.eclipse.ui.ide;bundle-version="3.17.0", org.eclipse.jface;bundle-version="3.20.0", org.eclipse.ui.tests.harness;bundle-version="1.6.0" +Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)", + org.junit.jupiter.api.function;version="[5.14.0,6.0.0)", + org.junit.platform.launcher;version="[1.14.0,2.0.0)", + org.junit.platform.suite.api;version="[1.14.0,2.0.0)" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: %providerName diff --git a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/DefaultPriorityFunctionTest.java b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/DefaultPriorityFunctionTest.java index 4c7afc93a4d..adb5581920f 100644 --- a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/DefaultPriorityFunctionTest.java +++ b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/DefaultPriorityFunctionTest.java @@ -13,8 +13,8 @@ *******************************************************************************/ package org.eclipse.text.quicksearch.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; @@ -24,21 +24,21 @@ import org.eclipse.text.quicksearch.internal.core.priority.DefaultPriorityFunction; import org.eclipse.text.quicksearch.internal.core.priority.PriorityFunction; import org.eclipse.text.quicksearch.internal.ui.QuickSearchActivator; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class DefaultPriorityFunctionTest { +class DefaultPriorityFunctionTest { private DefaultPriorityFunction fPriorityFunction; - @Before - public void setup() { + @BeforeEach + void setup() { fPriorityFunction = new DefaultPriorityFunction(); fPriorityFunction.configure(QuickSearchActivator.getDefault().getPreferences()); } @Test - public void testIgnoreLinkedContainers() throws Exception { + void testIgnoreLinkedContainers() throws Exception { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject p1 = root.getProject("p1"); p1.create(null); @@ -63,7 +63,7 @@ public void testIgnoreLinkedContainers() throws Exception { } @Test - public void testDoNotIgnoreVirtualFolder() throws Exception { + void testDoNotIgnoreVirtualFolder() throws Exception { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject p3 = root.getProject("p3"); diff --git a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/PrioriTreeTest.java b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/PrioriTreeTest.java index d03cbc775ab..c747237cdf0 100644 --- a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/PrioriTreeTest.java +++ b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/PrioriTreeTest.java @@ -12,24 +12,24 @@ import static org.eclipse.text.quicksearch.internal.core.priority.PriorityFunction.PRIORITY_DEFAULT; import static org.eclipse.text.quicksearch.internal.core.priority.PriorityFunction.PRIORITY_IGNORE; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.core.runtime.IPath; import org.eclipse.text.quicksearch.internal.core.priority.PrioriTree; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class PrioriTreeTest { +class PrioriTreeTest { PrioriTree tree; - @Before - public void setUp() throws Exception { + @BeforeEach + void setUp() throws Exception { tree = PrioriTree.create(); } @Test - public void testWithEmptyTree() { + void testWithEmptyTree() { //In the empty tree most paths are assigned 'DEFAULT' priority. checkPriority(PRIORITY_DEFAULT, "/"); checkPriority(PRIORITY_DEFAULT, "/foo/bar/zor"); @@ -48,7 +48,7 @@ public void testWithEmptyTree() { } @Test - public void testSinglePathSet() { + void testSinglePathSet() { setPriority("/foo/bar/zor", 100.0); //Path itself should have the set priority @@ -71,7 +71,7 @@ public void testSinglePathSet() { checkPriority(PRIORITY_IGNORE, "/foo/bar/zor/nested/big.zip"); } @Test - public void testSetOverlappingPaths() { + void testSetOverlappingPaths() { setPriority("/shared/foo", 50.0); setPriority("/shared/bar", 100.0); @@ -94,7 +94,7 @@ public void testSetOverlappingPaths() { * be the same. */ @Test - public void testSetOverlappingPaths2() { + void testSetOverlappingPaths2() { setPriority("/shared/bar", 100.0); setPriority("/shared/foo", 50.0); @@ -113,7 +113,7 @@ public void testSetOverlappingPaths2() { * Need support for setting priority of an entire subtree. */ @Test - public void testSetTreePriority() { + void testSetTreePriority() { setPriority("/promoted", 100.0); //Stuff not in the raised subtree should be unchanged @@ -133,7 +133,7 @@ public void testSetTreePriority() { * children already had a priority assigned before. */ @Test - public void testSetTreePriority2() { + void testSetTreePriority2() { setPriority("/promoted/sub/sub", 50.0); checkPriority(50.0, "/promoted"); checkPriority(50.0, "/promoted/sub"); @@ -161,8 +161,7 @@ private void setPriority(String pathStr, double pri) { } private void checkPriority(double expected, String pathStr) { - assertEquals(pathStr, - expected, tree.priority(new MockResource(pathStr)), 0); + assertEquals(expected, tree.priority(new MockResource(pathStr)), 0.0, pathStr); } } diff --git a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/QuickAccessComputerTest.java b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/QuickAccessComputerTest.java index ea8f373b21d..21e0ff1ce08 100644 --- a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/QuickAccessComputerTest.java +++ b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/QuickAccessComputerTest.java @@ -9,8 +9,8 @@ *******************************************************************************/ package org.eclipse.text.quicksearch.tests; -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.io.IOException; import java.io.InputStream; @@ -25,9 +25,9 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.tests.harness.util.DisplayHelper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class QuickAccessComputerTest { +class QuickAccessComputerTest { private final class QuickSearchDialogExtension extends QuickSearchDialog { private QuickSearchDialogExtension(IWorkbenchWindow window) { @@ -42,7 +42,7 @@ public Object[] getResult() { } @Test - public void testQuickAccessComputer() throws CoreException, IOException { + void testQuickAccessComputer() throws CoreException, IOException { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.currentTimeMillis()); project.create(null); project.open(null); diff --git a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/ResourceMatcherTest.java b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/ResourceMatcherTest.java index 58590edbb57..4ddcac94aa4 100644 --- a/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/ResourceMatcherTest.java +++ b/tests/org.eclipse.text.quicksearch.tests/src/org/eclipse/text/quicksearch/tests/ResourceMatcherTest.java @@ -12,26 +12,26 @@ *******************************************************************************/ package org.eclipse.text.quicksearch.tests; -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.core.runtime.IPath; import org.eclipse.text.quicksearch.internal.core.pathmatch.ResourceMatcher; import org.eclipse.text.quicksearch.internal.core.pathmatch.ResourceMatchers; -import org.junit.Test; +import org.junit.jupiter.api.Test; @SuppressWarnings("restriction") -public class ResourceMatcherTest { +class ResourceMatcherTest { @Test - public void simpleRelativePattern() throws Exception { + void simpleRelativePattern() throws Exception { assertMatch(true, "*.java", "/myproject/something/nested/foo.java"); assertMatch(false, "*.java", "/myproject/foo.class"); } @Test - public void commaSeparatedPaths() throws Exception { + void commaSeparatedPaths() throws Exception { String[] patterns = new String[] { // "*.java,*.properties", // "*.java, *.properties", // @@ -50,13 +50,13 @@ public void commaSeparatedPaths() throws Exception { } @Test - public void complexRelativePattern() throws Exception { + void complexRelativePattern() throws Exception { assertMatch(true, "src/**/*.java", "/myproject/src/my/package/Foo.java"); assertMatch(false, "src/**/*.java", "/myproject/resources/my/package/Foo.java"); } @Test - public void absolutePath() throws Exception { + void absolutePath() throws Exception { assertMatch(true, "/myproject/**/*.java", "/myproject/src/my/package/Foo.java"); assertMatch(false, "/myproject/**/*.java", "/otherproject/src/my/package/Foo.java"); } @@ -64,7 +64,7 @@ public void absolutePath() throws Exception { private void assertMatch(boolean expectedMatch, String patterns, String path) { assertTrue(IPath.fromOSString(path).isAbsolute()); ResourceMatcher matcher = ResourceMatchers.commaSeparatedPaths(patterns); - assertEquals("Wrong match with pattern: '" + patterns + "'", expectedMatch, matcher.matches(new MockResource(path))); + assertEquals(expectedMatch, matcher.matches(new MockResource(path)), "Wrong match with pattern: '" + patterns + "'"); // Most ResourceMatchers have a custom toString. Do a quick test to check for thrown exceptions. assertNotNull(matcher.toString());