diff --git a/gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF b/gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF index 81f34afb21..448e55ee5b 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF +++ b/gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.linuxtools.gcov.test Bundle-Version: 4.1.1.qualifier Bundle-Vendor: %bundleProvider -Require-Bundle: org.junit;bundle-version="4.10.0", +Require-Bundle: junit-jupiter-api, junit-platform-suite-api, org.eclipse.linuxtools.gcov.launch;bundle-version="1.0.0", org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="8.0.0", org.eclipse.linuxtools.profiling.tests, diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java index 6fd0396487..d4fecc018c 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/AllGcovTests.java @@ -12,11 +12,11 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.gcov.test; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; +import org.junit.platform.suite.api.SelectClasses; +import org.junit.platform.suite.api.Suite; -@RunWith(Suite.class) -@Suite.SuiteClasses({ +@Suite +@SelectClasses({ GcovTestC.class, GcovTestCPP.class, GcovTestCLibrary.class diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java index 0df56d8cdf..1a8a2caf92 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java @@ -13,6 +13,9 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.gcov.test; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; + import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -54,12 +57,11 @@ import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.navigator.CommonNavigator; import org.eclipse.ui.navigator.resources.ProjectExplorer; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.osgi.framework.FrameworkUtil; public abstract class GcovTest extends AbstractTest { @@ -75,7 +77,7 @@ public abstract class GcovTest extends AbstractTest { abstract protected boolean useDefaultBin(); abstract protected boolean getTestProducedReference(); - @BeforeClass + @BeforeAll public static void init() { display = Display.getDefault(); display.syncExec(() -> { @@ -87,12 +89,12 @@ public static void init() { } PlatformUI.getWorkbench().showPerspective(CUIPlugin.ID_CPERSPECTIVE, window); } catch (WorkbenchException e) { - Assert.fail("Couldn't open C/C++ perspective."); + fail("Couldn't open C/C++ perspective."); } }); } - @Before + @BeforeEach public void setUp() throws Exception { if (project == null) { ICProject cproject = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), getTestProjectName()); @@ -113,7 +115,7 @@ public void setUp() throws Exception { } } - @After + @AfterEach public void cleanUp() { display.syncExec(() -> { Shell[] shells = Display.getCurrent().getShells(); @@ -127,12 +129,12 @@ public void cleanUp() { }); } - @AfterClass + @AfterAll public static void finalCleanUp() { try { project.delete(true, null); } catch (CoreException e) { - Assert.fail("Project deletion failed"); + fail("Project deletion failed"); } finally { project = null; } @@ -164,7 +166,7 @@ private void testGcovFileDetails(final String filename, final String binPath) { return; } } - Assert.fail("Editor for file " + targetFile + " was not opened," + fail("Editor for file " + targetFile + " was not opened," + " instead opened " + openedFile + "."); } }); @@ -193,7 +195,7 @@ private void testGcovSummary(final String filename, String binPath, csvAction = (STExportToCSVAction) ((ActionContributionItem) item).getAction(); } } - Assert.assertNotNull("CSV-Export toolbar button does not exist.", csvAction); + assertNotNull(csvAction, "CSV-Export toolbar button does not exist."); for (IContributionItem item : items) { if (item instanceof ActionContributionItem) { @@ -262,12 +264,12 @@ public void testGcovSummaryByLaunch() { } } } catch (PartInitException e1) { - Assert.fail("Cannot show Project Explorer."); + fail("Cannot show Project Explorer."); } try { window.getActivePage().showView("org.eclipse.linuxtools.gcov.view"); } catch (PartInitException e2) { - Assert.fail("Cannot show GCov View."); + fail("Cannot show GCov View."); } }); diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java index 22c2d164fe..d4e5cd78f9 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTestCLibrary.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.gcov.test; +import org.junit.jupiter.api.Test; + public class GcovTestCLibrary extends GcovTest { @Override @@ -35,6 +37,7 @@ protected boolean useDefaultBin() { return false; } + @Test @Override public void testGcovSummaryByLaunch() { } diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java index 73b4470ebd..49e5a2e2a9 100755 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/STJunitUtils.java @@ -13,9 +13,9 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.gcov.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.io.File; import java.io.FileNotFoundException; @@ -85,7 +85,7 @@ public static String getAbsolutePath(String pluginId, String relativeName) { try { url = FileLocator.toFileURL(url); } catch (IOException e) { - assertNotNull("Problem locating " + relativeName + " in" + pluginId,e); + assertNotNull(e, "Problem locating " + relativeName + " in" + pluginId); } String filename = url.getFile(); return filename;