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
7 changes: 5 additions & 2 deletions tests/org.eclipse.text.quicksearch.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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
Expand All @@ -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");
Expand Down Expand Up @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", //
Expand All @@ -50,21 +50,21 @@ 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");
}

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());
Expand Down
Loading