From d01350a268688fddf603ddafa84e83172243c14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Tue, 19 Mar 2024 07:15:08 +0100 Subject: [PATCH] Fix assertions to actually tests for absence instead of empty Fix https://github.com/eclipse-pde/eclipse.pde/issues/1205 --- .../META-INF/MANIFEST.MF | 2 +- ui/org.eclipse.pde.ui.tests/pom.xml | 2 +- .../classpath/ClasspathResolutionTest.java | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF index 9955a31093..9531835e30 100644 --- a/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: PDE JUnit Tests Bundle-SymbolicName: org.eclipse.pde.ui.tests; singleton:=true -Bundle-Version: 3.12.400.qualifier +Bundle-Version: 3.12.500.qualifier Bundle-ClassPath: tests.jar Bundle-Activator: org.eclipse.pde.ui.tests.PDETestsPlugin Bundle-Vendor: Eclipse.org diff --git a/ui/org.eclipse.pde.ui.tests/pom.xml b/ui/org.eclipse.pde.ui.tests/pom.xml index ff4ac6769a..72b9feeca1 100644 --- a/ui/org.eclipse.pde.ui.tests/pom.xml +++ b/ui/org.eclipse.pde.ui.tests/pom.xml @@ -18,7 +18,7 @@ ../../ org.eclipse.pde.ui.tests - 3.12.400-SNAPSHOT + 3.12.500-SNAPSHOT eclipse-test-plugin diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/classpath/ClasspathResolutionTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/classpath/ClasspathResolutionTest.java index 7529613c65..1677ad9897 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/classpath/ClasspathResolutionTest.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/classpath/ClasspathResolutionTest.java @@ -62,12 +62,12 @@ public class ClasspathResolutionTest { @Rule public final TestRule deleteCreatedTestProjectsAfter = ProjectUtils.DELETE_CREATED_WORKSPACE_PROJECTS_AFTER; - private static String javaxAnnotationProviderBSN; + private static String jakartaAnnotationProviderBSN; @BeforeClass public static void getJavaxAnnotationProviderBSN() { Bundle bundle = FrameworkUtil.getBundle(jakarta.annotation.PostConstruct.class); - javaxAnnotationProviderBSN = bundle.getSymbolicName(); + jakartaAnnotationProviderBSN = bundle.getSymbolicName(); } @Test @@ -100,17 +100,17 @@ public void testImportSystemPackageDoesntAddExtraBundleJava11() throws Exception @Test public void testImportExternalPreviouslySystemPackageAddsExtraBundle() throws Exception { - loadTargetPlatform(javaxAnnotationProviderBSN); + loadTargetPlatform(jakartaAnnotationProviderBSN); IProject project = ProjectUtils.importTestProject("tests/projects/demoMissedExternalPackage"); // In Java 11, jakarta.annotation is not present, so the bundle *must* // be part of classpath List classpathEntries = getRequiredPluginContainerEntries(project); - assertThat(classpathEntries).anyMatch(filename -> filename.contains(javaxAnnotationProviderBSN)); + assertThat(classpathEntries).anyMatch(filename -> filename.contains(jakartaAnnotationProviderBSN)); } @Test public void testImportExternalPreviouslySystemPackageAddsExtraBundle_missingBREE() throws Exception { - loadTargetPlatform(javaxAnnotationProviderBSN); + loadTargetPlatform(jakartaAnnotationProviderBSN); IProject project = ProjectUtils.importTestProject("tests/projects/demoMissedExternalPackageNoBREE"); IExecutionEnvironment java11 = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("JavaSE-11"); @@ -118,24 +118,24 @@ public void testImportExternalPreviouslySystemPackageAddsExtraBundle_missingBREE // In Java 11, jakarta.annotation is not present, so the bundle *must* // be part of classpath, even if no BREE is specified List classpathEntries = getRequiredPluginContainerEntries(project); - assertThat(classpathEntries).anyMatch(filename -> filename.contains(javaxAnnotationProviderBSN)); + assertThat(classpathEntries).anyMatch(filename -> filename.contains(jakartaAnnotationProviderBSN)); } @Test public void testImportSystemPackageDoesntAddExtraBundleJava8() throws Exception { - loadTargetPlatform(javaxAnnotationProviderBSN); + loadTargetPlatform(jakartaAnnotationProviderBSN); try (var mocked = mockExtraExtraJRESystemPackages("JavaSE-1.8", List.of("jakarta.annotation"))) { IProject project = ProjectUtils.importTestProject("tests/projects/demoMissedSystemPackageJava8"); // In Java 8, jakarta.annotation is present, so the bundle must // *NOT* be part of classpath List classpathEntries = getRequiredPluginContainerEntries(project); - assertThat(classpathEntries).isEmpty(); + assertThat(classpathEntries).noneMatch(filename -> filename.contains(jakartaAnnotationProviderBSN)); } } @Test public void testImportSystemPackageDoesntAddExtraBundleJava8_osgiEERequirement() throws Exception { - loadTargetPlatform(javaxAnnotationProviderBSN); + loadTargetPlatform(jakartaAnnotationProviderBSN); try (var mocked = mockExtraExtraJRESystemPackages("JavaSE-1.8", List.of("jakarta.annotation"))) { IProject project = ProjectUtils .importTestProject("tests/projects/demoMissedSystemPackageJava8OsgiEERequirement"); @@ -143,7 +143,7 @@ public void testImportSystemPackageDoesntAddExtraBundleJava8_osgiEERequirement() // Require-Capability // --> jakarta.annotation bundle must not be on the classpath List classpathEntries = getRequiredPluginContainerEntries(project); - assertThat(classpathEntries).isEmpty(); + assertThat(classpathEntries).noneMatch(filename -> filename.contains(jakartaAnnotationProviderBSN)); } }