Skip to content

Commit

Permalink
JUnit 5 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
akurtakov committed Aug 29, 2024
1 parent ed4c75a commit a54d4ed
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: %Bundle-Vendor.0
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.junit;bundle-version="4.10.0",
junit-jupiter-api,
org.eclipse.cdt.core,
org.eclipse.ui.ide,
org.eclipse.remote.core;bundle-version="2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* Jeff Johnston (Red Hat Inc.) - Modified for usage in Linux Tools project
*******************************************************************************/
package org.eclipse.linuxtools.internal.profiling.tests;
import static org.junit.Assert.fail;

import static org.junit.jupiter.api.Assertions.fail;

import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*******************************************************************************/
package org.eclipse.linuxtools.profiling.tests;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeFalse;

import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
Expand Down Expand Up @@ -60,19 +60,19 @@ public static void checkConnectionInfo() {
if (host != null) {
HOST = host;
}
assumeTrue("Skip remote tests due lack of host information", !HOST.isEmpty());
assumeFalse(HOST.isEmpty(), "Skip remote tests due lack of host information");

String username = System.getenv("TEST_USERNAME");
if (username != null) {
USERNAME = username;
}
assumeTrue("Skip remote tests due lack of an username for connection", !USERNAME.isEmpty());
assumeFalse(USERNAME.isEmpty(), "Skip remote tests due lack of an username for connection");

String password = System.getenv("TEST_PASSWORD");
if (password != null) {
PASSWORD = password;
}
assumeTrue("Skip remote tests due lack of an password for connection", !PASSWORD.isEmpty());
assumeFalse(PASSWORD.isEmpty(), "Skip remote tests due lack of an password for connection");
}

protected void deleteResource (String directory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*******************************************************************************/
package org.eclipse.linuxtools.profiling.tests;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.linuxtools.callgraph.launch.tests
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.junit;bundle-version="4.7.0"
Require-Bundle: junit-jupiter-api
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-21
Fragment-Host: org.eclipse.linuxtools.callgraph.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.eclipse.linuxtools.internal.callgraph.launch.SystemTapOptionsTab;
import org.eclipse.linuxtools.profiling.tests.AbstractTest;
import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory;
import org.junit.After;
import org.junit.jupiter.api.AfterEach;
import org.osgi.framework.FrameworkUtil;

public class AbstractStapTest extends AbstractTest {
Expand Down Expand Up @@ -57,7 +57,7 @@ public void killStap() {

private List<ILaunch> launches = new ArrayList<>();

@After
@AfterEach
public void tearDown() {
if (!launches.isEmpty()) {
DebugPlugin.getDefault().getLaunchManager().removeLaunches(launches.toArray(new ILaunch[launches.size()]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*******************************************************************************/
package org.eclipse.linuxtools.callgraph.launch.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;

Expand All @@ -22,8 +22,8 @@
import org.eclipse.linuxtools.internal.callgraph.core.LaunchConfigurationConstants;
import org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph;
import org.eclipse.linuxtools.internal.callgraph.launch.SystemTapLaunchConfigurationDelegate;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

public class ConfigurationTest extends AbstractStapTest {

Expand Down Expand Up @@ -103,7 +103,7 @@ public void testConfig() throws CoreException {
killStap();
}

@After
@AfterEach
public void deleteFiles() {
File file = new File("/tmp/ThisFileDoesNothingDeleteIt");
if (file.exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.linuxtools.internal.callgraph.core.SystemTapUIErrorMessages;
import org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class LaunchShortcutsTest extends AbstractStapTest {

Expand All @@ -27,12 +27,12 @@ public class LaunchShortcutsTest extends AbstractStapTest {
* is sent.
*/

@Before
@BeforeEach
public void prep() throws Exception {
proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$
}

@After
@AfterEach
public void clean() throws Exception {
deleteProject(proj);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
*******************************************************************************/
package org.eclipse.linuxtools.callgraph.launch.tests;

import static org.junit.Assert.*;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;

import org.eclipse.linuxtools.internal.callgraph.core.PluginConstants;
import org.eclipse.linuxtools.internal.callgraph.core.SystemTapCommandGenerator;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class SystemTapCommandGeneratorTest extends AbstractStapTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.PrintStream;

import org.eclipse.core.resources.ResourcesPlugin;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class SystemTapCommandTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@

package org.eclipse.linuxtools.callgraph.launch.tests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.linuxtools.internal.callgraph.core.SystemTapErrorHandler;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class SystemTapErrorHandlerTest {

private SystemTapErrorHandler errHandler;
private String errorString;

@Before
@BeforeEach
public void setUp() {
errHandler = new SystemTapErrorHandler();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class SystemTapTabTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.draw2d,
org.eclipse.linuxtools.callgraph;bundle-version="0.0.1",
org.junit;bundle-version="4.0.0",
junit-jupiter-api,
junit-platform-suite-api,
org.eclipse.zest.core;bundle-version="1.2.0",
org.eclipse.zest.layouts;bundle-version="1.1.0"
Bundle-ActivationPolicy: lazy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

package org.eclipse.linuxtools.callgraph.tests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({MouseListenerTest.class, StapGraphParserTest.class, SystemTapGraphTest.class, SystemTapGraphViewTest.class })
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@Suite
@SelectClasses({MouseListenerTest.class, StapGraphParserTest.class, SystemTapGraphTest.class, SystemTapGraphViewTest.class })
public class AllTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.eclipse.linuxtools.internal.callgraph.core.ViewFactory;
import org.eclipse.linuxtools.internal.callgraph.graphlisteners.StapGraphMouseListener;
import org.eclipse.zest.core.widgets.GraphItem;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class MouseListenerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
*******************************************************************************/
package org.eclipse.linuxtools.callgraph.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
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.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.util.ArrayList;
import java.util.HashMap;

import org.eclipse.linuxtools.internal.callgraph.StapGraphParser;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class StapGraphParserTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
*******************************************************************************/
package org.eclipse.linuxtools.callgraph.tests;

import static org.junit.Assert.assertEquals;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
import java.util.ArrayList;
Expand All @@ -25,7 +26,7 @@
import org.eclipse.linuxtools.internal.callgraph.StapGraphParser;
import org.eclipse.linuxtools.internal.callgraph.core.StapUIJob;
import org.eclipse.linuxtools.internal.callgraph.core.ViewFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class SystemTapGraphTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

package org.eclipse.linuxtools.callgraph.tests;

import static org.junit.Assert.assertEquals;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.eclipse.linuxtools.internal.callgraph.core.SystemTapTextView;
import org.eclipse.linuxtools.internal.callgraph.core.ViewFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class SystemTapGraphViewTest {
private SystemTapTextView stapView = new SystemTapTextView();
Expand Down

0 comments on commit a54d4ed

Please sign in to comment.