Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/CatalogCategoryComparatorTest.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/CatalogCategoryComparatorTest.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/CatalogCategoryComparatorTest.java b/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/CatalogCategoryComparatorTest.java
index fb77951d3..38910a14e 100644
--- a/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/CatalogCategoryComparatorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/CatalogCategoryComparatorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2018 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,14 @@
package org.eclipse.equinox.p2.discovery.tests.core.util;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.equinox.internal.p2.discovery.model.CatalogCategory;
import org.eclipse.equinox.internal.p2.discovery.util.CatalogCategoryComparator;
+import org.junit.Before;
+import org.junit.Test;
-public class CatalogCategoryComparatorTest extends TestCase {
+public class CatalogCategoryComparatorTest {
private CatalogCategoryComparator comparator;
@@ -23,14 +26,14 @@ public class CatalogCategoryComparatorTest extends TestCase {
private CatalogCategory category2;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() {
comparator = new CatalogCategoryComparator();
category1 = new CatalogCategory();
category2 = new CatalogCategory();
}
+ @Test
public void testSortByRelevanceInequal() {
category1.setRelevance("100"); //$NON-NLS-1$
category2.setRelevance("50"); //$NON-NLS-1$
@@ -38,12 +41,14 @@ public class CatalogCategoryComparatorTest extends TestCase {
assertEquals(1, comparator.compare(category2, category1));
}
+ @Test
public void testSortByRelevanceOneNotSpecified() {
category1.setRelevance("10"); //$NON-NLS-1$
assertEquals(-1, comparator.compare(category1, category2));
assertEquals(1, comparator.compare(category2, category1));
}
+ @Test
public void testSortByRelevanceSame() {
category1.setRelevance("10"); //$NON-NLS-1$
category1.setName("test"); //$NON-NLS-1$
@@ -55,6 +60,7 @@ public class CatalogCategoryComparatorTest extends TestCase {
assertEquals(0, comparator.compare(category2, category1));
}
+ @Test
public void testSortByRelevanceSameIdsDiffer() {
category1.setRelevance("10"); //$NON-NLS-1$
category1.setName("test"); //$NON-NLS-1$
@@ -66,6 +72,7 @@ public class CatalogCategoryComparatorTest extends TestCase {
assertEquals(1, comparator.compare(category2, category1));
}
+ @Test
public void testSortByRelevanceSameNamesDiffer() {
category1.setRelevance("10"); //$NON-NLS-1$
category1.setName("a"); //$NON-NLS-1$

Back to the top