2020import java .io .ByteArrayInputStream ;
2121import java .io .File ;
2222import java .io .IOException ;
23- import java .util .Arrays ;
2423import java .util .Collection ;
2524import java .util .List ;
2625import java .util .Map ;
3534import org .eclipse .debug .core .ILaunchConfigurationWorkingCopy ;
3635import org .eclipse .debug .core .ILaunchManager ;
3736import org .eclipse .jdt .launching .IJavaLaunchConfigurationConstants ;
38- import org .eclipse .jdt .launching .IRuntimeClasspathEntry ;
3937import org .eclipse .m2e .core .MavenPlugin ;
4038import org .eclipse .m2e .core .internal .preferences .MavenConfigurationImpl ;
4139import org .eclipse .m2e .jdt .internal .UnitTestSupport ;
4240import org .eclipse .m2e .jdt .internal .launch .MavenRuntimeClasspathProvider ;
4341import org .eclipse .m2e .tests .common .AbstractMavenProjectTestCase ;
44- import org .hamcrest .Description ;
4542import org .hamcrest .Matchers ;
46- import org .hamcrest .TypeSafeMatcher ;
4743import org .junit .Before ;
4844import org .junit .Test ;
4945import 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