diff --git a/sandbox_junit_cleanup/META-INF/MANIFEST.MF b/sandbox_junit_cleanup/META-INF/MANIFEST.MF index 18f36867..e1b33638 100644 --- a/sandbox_junit_cleanup/META-INF/MANIFEST.MF +++ b/sandbox_junit_cleanup/META-INF/MANIFEST.MF @@ -17,7 +17,10 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.jface, org.eclipse.ui.workbench, org.eclipse.jdt.core.manipulation, - sandbox_common + sandbox_common, + org.junit, + org.eclipse.jdt.junit.runtime, + org.eclipse.jdt.junit4.runtime Bundle-ActivationPolicy: lazy Eclipse-RegisterBuddy: org.eclipse.jdt.core.manipulation Import-Package: org.sandbox.jdt.internal.common, diff --git a/sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java b/sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java index 14d39293..f3b294eb 100644 --- a/sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java +++ b/sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java @@ -17,6 +17,7 @@ import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.junit.JUnitCore; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -24,24 +25,24 @@ import org.junit.jupiter.params.provider.EnumSource; import org.sandbox.jdt.internal.corext.fix2.MYCleanUpConstants; import org.sandbox.jdt.ui.tests.quickfix.rules.AbstractEclipseJava; -import org.sandbox.jdt.ui.tests.quickfix.rules.EclipseJava8; +import org.sandbox.jdt.ui.tests.quickfix.rules.EclipseJava17; public class JUnitMigrationCleanUpTest { @RegisterExtension - AbstractEclipseJava context4junit4= new EclipseJava8(); + AbstractEclipseJava context4junit4= new EclipseJava17(); @RegisterExtension - AbstractEclipseJava context4junit5= new EclipseJava8(); + AbstractEclipseJava context4junit5= new EclipseJava17(); IPackageFragmentRoot fRootJUnit4; IPackageFragmentRoot fRootJUnit5; @BeforeEach public void setup() throws CoreException { - fRootJUnit4= context4junit4.createClasspathForJUnit("4"); - fRootJUnit5= context4junit5.createClasspathForJUnit("5"); + fRootJUnit4= context4junit4.createClasspathForJUnit(JUnitCore.JUNIT4_CONTAINER_PATH); + fRootJUnit5= context4junit5.createClasspathForJUnit(JUnitCore.JUNIT5_CONTAINER_PATH); } enum JUnitCleanupCases{ @@ -801,8 +802,21 @@ public void test3() throws IOException{ @EnumSource(JUnitCleanupCases.class) public void testJUnitCleanupParametrized(JUnitCleanupCases test) throws CoreException { IPackageFragment pack= fRootJUnit4.createPackageFragment("test", true, null); - ICompilationUnit cu= pack.createCompilationUnit("MyTest.java", test.given, false, null); //$NON-NLS-1$ + ICompilationUnit cu= pack.createCompilationUnit("MyTest.java", test.given, true, null); //$NON-NLS-1$ context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSERT); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSUME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_SUITE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORECLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTERCLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_IGNORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_TEST); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH); context4junit4.assertRefactoringResultAsExpected(new ICompilationUnit[] {cu}, new String[] {test.expected}, null); } @@ -902,6 +916,19 @@ public start(){ } """, false, null); //$NON-NLS-1$ context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSERT); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSUME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_SUITE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORECLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTERCLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_IGNORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_TEST); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH); context4junit4.assertRefactoringResultAsExpected(new ICompilationUnit[] {cu,cu2}, new String[] { """ package test; @@ -989,6 +1016,19 @@ public start(){ } """, false, null); //$NON-NLS-1$ context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSERT); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSUME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_SUITE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORECLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTERCLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_IGNORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_TEST); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH); context4junit4.assertRefactoringResultAsExpected(new ICompilationUnit[] {cu,cu2}, new String[] { """ package test; @@ -1082,6 +1122,19 @@ protected void after() { } """, false, null); //$NON-NLS-1$ context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSERT); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSUME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_SUITE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORECLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTERCLASS); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_IGNORE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_TEST); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE); + context4junit4.enable(MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH); context4junit4.assertRefactoringResultAsExpected(new ICompilationUnit[] {cu,cu2,cu3}, new String[] { """ package test; diff --git a/sandbox_junit_cleanup_test/testresources/rtstubs_17.jar b/sandbox_junit_cleanup_test/testresources/rtstubs_17.jar new file mode 100644 index 00000000..fb6cb938 Binary files /dev/null and b/sandbox_junit_cleanup_test/testresources/rtstubs_17.jar differ diff --git a/sandbox_product/sandbox.product b/sandbox_product/sandbox.product index 46ea6fc9..cfb22cd0 100644 --- a/sandbox_product/sandbox.product +++ b/sandbox_product/sandbox.product @@ -1,7 +1,7 @@ - + @@ -196,16 +196,7 @@ United States, other countries, or both. - - - - - - - - - @@ -214,6 +205,11 @@ United States, other countries, or both. + + + + + diff --git a/sandbox_product/sandbox.product.launch b/sandbox_product/sandbox.product.launch index f1a619ee..dbc18273 100644 --- a/sandbox_product/sandbox.product.launch +++ b/sandbox_product/sandbox.product.launch @@ -1,15 +1,15 @@ - - - - - - - + + + + + + + @@ -29,79 +29,47 @@ - - + + - + - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - @@ -114,894 +82,232 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + diff --git a/sandbox_target/eclipse.target b/sandbox_target/eclipse.target index bf06a356..a9464a2d 100644 --- a/sandbox_target/eclipse.target +++ b/sandbox_target/eclipse.target @@ -2,8 +2,11 @@ + + @@ -38,41 +93,13 @@ + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox_test_commons/META-INF/MANIFEST.MF b/sandbox_test_commons/META-INF/MANIFEST.MF index 2557f891..4f62289f 100644 --- a/sandbox_test_commons/META-INF/MANIFEST.MF +++ b/sandbox_test_commons/META-INF/MANIFEST.MF @@ -24,5 +24,8 @@ Require-Bundle: org.eclipse.jdt.ui, org.eclipse.ltk.core.refactoring, org.eclipse.jdt.junit4.runtime, org.eclipse.jdt.junit5.runtime, - org.junit + org.junit, + org.eclipse.jdt.junit;visibility:=reexport, + org.eclipse.jdt.junit.core;visibility:=reexport, + org.eclipse.jdt.junit.runtime Export-Package: org.sandbox.jdt.ui.tests.quickfix.rules diff --git a/sandbox_test_commons/src/org/sandbox/jdt/ui/tests/quickfix/rules/AbstractEclipseJava.java b/sandbox_test_commons/src/org/sandbox/jdt/ui/tests/quickfix/rules/AbstractEclipseJava.java index d7081a22..f67c9ff5 100644 --- a/sandbox_test_commons/src/org/sandbox/jdt/ui/tests/quickfix/rules/AbstractEclipseJava.java +++ b/sandbox_test_commons/src/org/sandbox/jdt/ui/tests/quickfix/rules/AbstractEclipseJava.java @@ -75,8 +75,6 @@ public class AbstractEclipseJava implements AfterEachCallback, BeforeEachCallback { - public static final String JUNIT_CONTAINER_ID= "org.eclipse.jdt.junit.JUNIT_CONTAINER"; //$NON-NLS-1$ - private final String testresources_stubs; private final String compliance; private static final String TEST_SETUP_PROJECT= "TestSetupProject"; //$NON-NLS-1$ @@ -107,14 +105,13 @@ public void beforeEach(ExtensionContext context) throws CoreException { disableAll(); } - public IPackageFragmentRoot createClasspathForJUnit(String tail) throws JavaModelException, CoreException { - IPath junit4ContainerPath= new Path(JUNIT_CONTAINER_ID).append(tail); + public IPackageFragmentRoot createClasspathForJUnit(IPath junitContainerPath) throws JavaModelException, CoreException { IJavaProject fProject = getJavaProject(); fProject.setRawClasspath(getDefaultClasspath(), null); - IClasspathEntry cpe= JavaCore.newContainerEntry(junit4ContainerPath); + IClasspathEntry cpe= JavaCore.newContainerEntry(junitContainerPath); AbstractEclipseJava.addToClasspath(fProject, cpe); - IPackageFragmentRoot sourceContainer= AbstractEclipseJava.addSourceContainer(fProject, "src"); - return sourceContainer; + fSourceFolder= AbstractEclipseJava.addSourceContainer(fProject, "src"); + return fSourceFolder; } @Override