Skip to content

Commit 2036684

Browse files
committed
Move tests to dedicated test repo
1 parent f9092af commit 2036684

File tree

4 files changed

+2
-127
lines changed

4 files changed

+2
-127
lines changed

org.eclipse.m2e.jdt.tests/projects/surefireFailsafeToTestLaunchSettings/junit5TestProject/pom.xml

Lines changed: 0 additions & 47 deletions
This file was deleted.

org.eclipse.m2e.jdt.tests/projects/surefireFailsafeToTestLaunchSettings/junit5TestProject/src/test/java/testMvn/TestClass.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

org.eclipse.m2e.jdt.tests/src/org/eclipse/m2e/jdt/tests/UnitTestLaunchConfigConfigurationTest.java

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.ByteArrayInputStream;
2121
import java.io.File;
2222
import java.io.IOException;
23-
import java.util.Arrays;
2423
import java.util.Collection;
2524
import java.util.List;
2625
import java.util.Map;
@@ -35,15 +34,12 @@
3534
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
3635
import org.eclipse.debug.core.ILaunchManager;
3736
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
38-
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
3937
import org.eclipse.m2e.core.MavenPlugin;
4038
import org.eclipse.m2e.core.internal.preferences.MavenConfigurationImpl;
4139
import org.eclipse.m2e.jdt.internal.UnitTestSupport;
4240
import org.eclipse.m2e.jdt.internal.launch.MavenRuntimeClasspathProvider;
4341
import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase;
44-
import org.hamcrest.Description;
4542
import org.hamcrest.Matchers;
46-
import org.hamcrest.TypeSafeMatcher;
4743
import org.junit.Before;
4844
import org.junit.Test;
4945
import org.junit.runner.RunWith;
@@ -58,7 +54,7 @@ public class UnitTestLaunchConfigConfigurationTest extends AbstractMavenProjectT
5854
private static final String REPLACED_SUREFIRE_POM_STRING = "<!-- surefireArgs: replacedByArgsSets -->";
5955
private static final String REPLACED_FAILSAFE_POM_STRING = "<!-- failsafeArgs: replacedByArgsSets -->";
6056
private static final String ROOT_PATH = "/projects/surefireFailsafeToTestLaunchSettings";
61-
private static final ILaunchManager LAUNCH_MANAGER = DebugPlugin.getDefault().getLaunchManager();
57+
private static ILaunchManager LAUNCH_MANAGER = DebugPlugin.getDefault().getLaunchManager();
6258

6359
/*
6460
* XML allows encoding set of control characters: space (U+0020), carriage
@@ -367,64 +363,6 @@ public void test_deferred_variable_are_resolved() throws CoreException, IOExcept
367363
assertFalse(argLine.contains("@{titi.tata}")); // unresolved property is removed
368364
}
369365

370-
@Test
371-
public void testJUnit4TestWithJUnit5Dependency() throws CoreException, IOException, InterruptedException {
372-
assumeTrue("Only relevant for JUnit", MavenRuntimeClasspathProvider.JDT_JUNIT_TEST.equals(testType));
373-
374-
// Get launch type
375-
ILaunchConfigurationType type = LAUNCH_MANAGER.getLaunchConfigurationType(testType);
376-
377-
assumeTrue(testType + " support not available", type != null);
378-
379-
File pomFile = getTestFile("junit5TestProject/pom.xml");
380-
381-
IProject project = importProject(pomFile.getAbsolutePath());
382-
383-
// create basic unit test
384-
createDefaultTest(project, type, "testMvn.JUnit4Test");
385-
386-
updateProject(project);
387-
waitForJobsToComplete();
388-
389-
ILaunchConfiguration[] updatedConfigurations = LAUNCH_MANAGER.getLaunchConfigurations(type);
390-
assertTrue(updatedConfigurations.length == 1);
391-
392-
ILaunchConfiguration config = updatedConfigurations[0];
393-
MavenRuntimeClasspathProvider provider = new MavenRuntimeClasspathProvider();
394-
IRuntimeClasspathEntry[] classpathEntries = provider.computeUnresolvedClasspath(config); // to trigger classpath
395-
// computation
396-
IRuntimeClasspathEntry[] resolvedClasspathEntries = provider.resolveClasspath(classpathEntries, config);
397-
// make sure that vintage engine is on the classpath (as being part of the
398-
// m-surefire-p classpath)
399-
assertThat(Arrays.asList(resolvedClasspathEntries),
400-
Matchers.hasItem(new IRuntimeClasspathEntryMatcherByFilename("junit-vintage-engine-5.14.1.jar")));
401-
}
402-
403-
static final class IRuntimeClasspathEntryMatcherByFilename extends TypeSafeMatcher<IRuntimeClasspathEntry> {
404-
405-
private final String filename;
406-
407-
public IRuntimeClasspathEntryMatcherByFilename(String filename) {
408-
this.filename = filename;
409-
}
410-
411-
@Override
412-
public void describeTo(Description description) {
413-
description.appendText("IRuntimeClasspathEntry with location ending with ").appendValue(filename);
414-
}
415-
416-
@Override
417-
protected void describeMismatchSafely(IRuntimeClasspathEntry item, Description mismatchDescription) {
418-
mismatchDescription.appendText("was IRuntimeClasspathEntry ").appendValue(item)
419-
.appendText(" with location ").appendValue(item.getLocation());
420-
}
421-
422-
@Override
423-
protected boolean matchesSafely(IRuntimeClasspathEntry item) {
424-
return item.getLocation() != null && item.getLocation().endsWith(filename);
425-
}
426-
}
427-
428366
private void updateProject(IProject project) throws CoreException, InterruptedException {
429367
MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor);
430368
waitForJobsToComplete();
@@ -462,5 +400,4 @@ private void mergePomAndPluginConfigIntoProject(IProject project, File pomTempla
462400
private File getTestFile(String filename) throws IOException {
463401
return new File(FileLocator.toFileURL(getClass().getResource(ROOT_PATH + "/" + filename)).getFile());
464402
}
465-
466403
}

0 commit comments

Comments
 (0)