diff --git a/org.eclipse.lemminx/src/test/java/org/eclipse/lemminx/services/extensions/XMLCompletionExtensionTest.java b/org.eclipse.lemminx/src/test/java/org/eclipse/lemminx/services/extensions/XMLCompletionExtensionTest.java
new file mode 100644
index 000000000..a7778ced1
--- /dev/null
+++ b/org.eclipse.lemminx/src/test/java/org/eclipse/lemminx/services/extensions/XMLCompletionExtensionTest.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+* Copyright (c) 2024 Christoph Läubrich and others.
+* All rights reserved. This program and the accompanying materials
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v20.html
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* Contributors:
+* Christoph Läubrich - initial API and implementation
+*******************************************************************************/
+package org.eclipse.lemminx.services.extensions;
+
+import org.eclipse.lemminx.AbstractCacheBasedTest;
+import org.eclipse.lemminx.XMLAssert;
+import org.eclipse.lemminx.commons.BadLocationException;
+import org.eclipse.lemminx.services.XMLLanguageService;
+import org.eclipse.lemminx.services.extensions.completion.ICompletionParticipant;
+import org.eclipse.lemminx.services.extensions.completion.ICompletionRequest;
+import org.eclipse.lemminx.services.extensions.completion.ICompletionResponse;
+import org.eclipse.lsp4j.CompletionItem;
+import org.eclipse.lsp4j.jsonrpc.CancelChecker;
+import org.junit.jupiter.api.Test;
+
+/**
+ * XML completion tests which uses the {@link ICompletionParticipant}
+ */
+public class XMLCompletionExtensionTest extends AbstractCacheBasedTest {
+
+ private static final CompletionItem HELLO_WORLD_ITEM = XMLAssert.c("World", "World");
+
+ private final class TestCompletionParticipant implements ICompletionParticipant {
+ @Override
+ public void onXMLContent(ICompletionRequest request, ICompletionResponse response, CancelChecker cancelChecker)
+ throws Exception {
+ System.out.println("onXMLContent: " + request.getCurrentTag());
+ if (request.getCurrentTag().equals("hello")) {
+ response.addCompletionAttribute(HELLO_WORLD_ITEM);
+ }
+ }
+
+ @Override
+ public void onTagOpen(ICompletionRequest completionRequest, ICompletionResponse completionResponse,
+ CancelChecker cancelChecker) throws Exception {
+ }
+
+ @Override
+ public void onDTDSystemId(String valuePrefix, ICompletionRequest request, ICompletionResponse response,
+ CancelChecker cancelChecker) throws Exception {
+ }
+
+ @Override
+ public void onAttributeValue(String valuePrefix, ICompletionRequest request, ICompletionResponse response,
+ CancelChecker cancelChecker) throws Exception {
+ }
+
+ @Override
+ public void onAttributeName(boolean generateValue, ICompletionRequest request, ICompletionResponse response,
+ CancelChecker cancelChecker) throws Exception {
+ }
+ }
+
+ /**
+ * Test that
+ * {@link ICompletionParticipant#onXMLContent(ICompletionRequest, ICompletionResponse, CancelChecker)}
+ * is called for a simple content tag
+ *
+ * @throws BadLocationException
+ */
+ @Test
+ public void testSimpleCompletion() throws BadLocationException {
+ XMLLanguageService service = new XMLLanguageService();
+ service.registerCompletionParticipant(new TestCompletionParticipant());
+ XMLAssert.testCompletionFor(service, "|", (String) null, null, null, null, true,
+ HELLO_WORLD_ITEM);
+ }
+
+ /**
+ * Test that
+ * {@link ICompletionParticipant#onXMLContent(ICompletionRequest, ICompletionResponse, CancelChecker)}
+ * is called for a CDATA content tag
+ *
+ * @throws BadLocationException
+ */
+ @Test
+ public void testCDATACompletion() throws BadLocationException {
+ XMLLanguageService service = new XMLLanguageService();
+ service.registerCompletionParticipant(new TestCompletionParticipant());
+ XMLAssert.testCompletionFor(service, "", (String) null, null, null, null, true,
+ HELLO_WORLD_ITEM);
+ }
+
+}