Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/AllTests.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java25
2 files changed, 20 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/AllTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/AllTests.java
index 9457b7134..578e8c582 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/AllTests.java
@@ -1,6 +1,5 @@
package org.eclipse.equinox.p2.tests.importexport;
-import junit.framework.TestCase;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -8,7 +7,7 @@ import org.junit.runners.Suite;
* Performs all automated importexport tests.
*/
@RunWith(Suite.class)
-@Suite.SuiteClasses({ImportExportTests.class, ImportExportRemoteTests.class})
-public class AllTests extends TestCase {
+@Suite.SuiteClasses({ ImportExportTests.class, ImportExportRemoteTests.class })
+public class AllTests {
// test suite
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java
index e20c3097e..9e5251645 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java
@@ -9,20 +9,23 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.query;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.*;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.ui.ElementQueryDescriptor;
import org.eclipse.equinox.internal.p2.ui.ElementWrapper;
import org.eclipse.equinox.p2.query.*;
+import org.junit.Test;
/**
* Tests the Query Descriptor
*/
-public class QueryDescriptorTest extends TestCase {
+public class QueryDescriptorTest {
class SimpleQueryable implements IQueryable<String> {
- List<String> elements = Arrays.asList(new String[] {"a", "b", "c", "d", "e"});
+ List<String> elements = Arrays.asList(new String[] { "a", "b", "c", "d", "e" });
@Override
public IQueryResult<String> query(IQuery<String> query, IProgressMonitor monitor) {
@@ -83,33 +86,41 @@ public class QueryDescriptorTest extends TestCase {
}
}
+ @Test
public void testSimpleDescriptorWithWrapper() {
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(), new Collector<>(), new StringWrapper());
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(),
+ new Collector<>(), new StringWrapper());
Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 2, collection.size());
assertTrue("1.1", collection.contains(new WrappedString("a")));
assertTrue("1.1", collection.contains(new WrappedString("b")));
}
+ @Test
public void testSimpleDescriptorWithoutWrapper() {
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(), new Collector<>());
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(),
+ new Collector<>());
Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 2, collection.size());
assertTrue("1.1", collection.contains("a"));
assertTrue("1.1", collection.contains("b"));
}
+ @Test
public void testCompoundDescriptorAND() {
IQuery<Object> query = QueryUtil.createCompoundQuery(new SimpleMatchQuery(), new SimpleMatchQuery2(), true);
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query, new Collector<>(), new StringWrapper());
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query,
+ new Collector<>(), new StringWrapper());
Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 1, collection.size());
assertTrue("1.1", collection.contains(new WrappedString("b")));
}
+ @Test
public void testCompoundDescriptorOR() {
IQuery<Object> query = QueryUtil.createCompoundQuery(new SimpleMatchQuery(), new SimpleMatchQuery2(), false);
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query, new Collector<>(), new StringWrapper());
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query,
+ new Collector<>(), new StringWrapper());
Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 3, collection.size());
assertTrue("1.1", collection.contains(new WrappedString("a")));

Back to the top