From 608222ef7b919c2836429e35dff1d1b2c0ed83e7 Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Mon, 20 Jul 2026 12:38:17 +0200 Subject: [PATCH 1/2] chore: Make ...ui.test a fragment bundle of ...ui bundle This way, tests in com.microsoft.copilot.eclipse.ui.test can access package-private methods and we don't need to make them public. In addition, we no longer need to maintain redundant plug-in dependencies in the test bundle. --- .../META-INF/MANIFEST.MF | 28 ++++--------------- .../build.properties | 2 +- .../{plugin.xml => fragment.xml} | 0 3 files changed, 6 insertions(+), 24 deletions(-) rename com.microsoft.copilot.eclipse.ui.test/{plugin.xml => fragment.xml} (100%) diff --git a/com.microsoft.copilot.eclipse.ui.test/META-INF/MANIFEST.MF b/com.microsoft.copilot.eclipse.ui.test/META-INF/MANIFEST.MF index 9d33676c..fa2de66b 100644 --- a/com.microsoft.copilot.eclipse.ui.test/META-INF/MANIFEST.MF +++ b/com.microsoft.copilot.eclipse.ui.test/META-INF/MANIFEST.MF @@ -5,28 +5,10 @@ Bundle-SymbolicName: com.microsoft.copilot.eclipse.ui.test;singleton:=true Bundle-Version: 0.20.0.qualifier Bundle-Vendor: GitHub Copilot Bundle-RequiredExecutionEnvironment: JavaSE-17 +Fragment-Host: com.microsoft.copilot.eclipse.ui Automatic-Module-Name: com.microsoft.copilot.eclipse.ui.test -Import-Package: org.objenesis;version="[3.4.0,4.0.0)", - org.osgi.framework;version="[1.10.0,2.0.0)" -Require-Bundle: org.mockito.mockito-core;bundle-version="5.14.2", - org.eclipse.lsp4e;bundle-version="0.18.1", - org.eclipse.jdt.annotation;resolution:=optional, - junit-jupiter-api;bundle-version="5.10.1", +Import-Package: org.objenesis;version="[3.4.0,4.0.0)" +Require-Bundle: junit-jupiter-api;bundle-version="5.10.1", junit-jupiter-params;bundle-version="5.10.1", - org.mockito.junit-jupiter;bundle-version="5.10.2", - com.microsoft.copilot.eclipse.core;bundle-version="0.20.0", - com.microsoft.copilot.eclipse.ui;bundle-version="0.20.0", - org.eclipse.ui;bundle-version="3.205.0", - org.eclipse.ui.ide, - org.eclipse.ui.workbench.texteditor, - org.eclipse.ui.editors, - org.eclipse.jface.text;bundle-version="3.24.200", - org.eclipse.lsp4j;bundle-version="0.21.1", - org.eclipse.core.resources, - org.eclipse.core.runtime, - org.eclipse.core.expressions, - org.eclipse.core.net;bundle-version="1.5.200", - org.eclipse.e4.core.services;bundle-version="2.4.200", - org.osgi.service.event, - com.google.gson, - com.microsoft.copilot.eclipse.terminal.api;bundle-version="0.20.0" + org.mockito.mockito-core;bundle-version="5.14.2", + org.mockito.junit-jupiter;bundle-version="5.10.2" diff --git a/com.microsoft.copilot.eclipse.ui.test/build.properties b/com.microsoft.copilot.eclipse.ui.test/build.properties index 4c15b450..07c97efe 100644 --- a/com.microsoft.copilot.eclipse.ui.test/build.properties +++ b/com.microsoft.copilot.eclipse.ui.test/build.properties @@ -2,5 +2,5 @@ source.. = src output.. = target/classes bin.includes = META-INF/,\ .,\ - plugin.xml + fragment.xml diff --git a/com.microsoft.copilot.eclipse.ui.test/plugin.xml b/com.microsoft.copilot.eclipse.ui.test/fragment.xml similarity index 100% rename from com.microsoft.copilot.eclipse.ui.test/plugin.xml rename to com.microsoft.copilot.eclipse.ui.test/fragment.xml From d6f3dfdf3a886e75f2f1a8b5cddd54eae58fbb26 Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Thu, 23 Jul 2026 12:42:43 +0200 Subject: [PATCH 2/2] Add additional assertion in test case Incorporate feedback from review commit https://github.com/microsoft/copilot-for-eclipse/pull/361#issuecomment-5045189615 --- .../ui/nes/NesAnnotationTypeMappingTest.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/nes/NesAnnotationTypeMappingTest.java b/com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/nes/NesAnnotationTypeMappingTest.java index 15aee61e..49ab8d6a 100644 --- a/com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/nes/NesAnnotationTypeMappingTest.java +++ b/com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/nes/NesAnnotationTypeMappingTest.java @@ -9,7 +9,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.Platform; import org.eclipse.ui.texteditor.AnnotationTypeLookup; @@ -19,7 +21,7 @@ class NesAnnotationTypeMappingTest { private static final String ANNOTATION_TYPES_EXTENSION_POINT = "org.eclipse.ui.editors.annotationTypes"; private static final String FOREIGN_TEXT_MARKER = - "com.microsoft.copilot.eclipse.ui.test.foreignTextMarker"; + "com.microsoft.copilot.eclipse.ui.foreignTextMarker"; private static final String NES_ANNOTATION_PREFIX = "com.microsoft.copilot.eclipse.ui.nes."; private static final String NES_CHANGE_ANNOTATION = NES_ANNOTATION_PREFIX + "change"; private static final String NES_DELETE_ANNOTATION = NES_ANNOTATION_PREFIX + "delete"; @@ -31,9 +33,22 @@ void testForeignTextMarkerSubtypeDoesNotResolveToNesAnnotations() { String annotationType = lookup.getAnnotationType(FOREIGN_TEXT_MARKER, IMarker.SEVERITY_INFO); + // assert our marker type is properly registered, before checking annotation type mapping + assertTrue(isMarkerTypeDeclared(FOREIGN_TEXT_MARKER)); assertNotEquals(NES_CHANGE_ANNOTATION, annotationType); assertNotEquals(NES_DELETE_ANNOTATION, annotationType); } + + private boolean isMarkerTypeDeclared(String markerTypeId) { + IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(ResourcesPlugin.PI_RESOURCES, + "markers"); + for (IExtension ext : point.getExtensions()) { + if (markerTypeId.equals(ext.getUniqueIdentifier())) { + return true; + } + } + return false; + } @Test void testNesAnnotationTypesDoNotMapToRootTextMarker() {