From f767e693ffe2048639b773dba4b6221c7aa091e7 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Fri, 29 Nov 2024 13:03:33 +0100 Subject: [PATCH] additional tests to prepare for improved content-assist for annotations as soon as a new JDT parser version is around --- .../ConditionalOnPropertyCompletionTest.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalOnPropertyCompletionTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalOnPropertyCompletionTest.java index 13097d52b9..646eb03f90 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalOnPropertyCompletionTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalOnPropertyCompletionTest.java @@ -209,6 +209,39 @@ public void testConditionalOnPropertyCompletionWithPrefixAndAttributeWithNameAtt assertEquals("prop3", completions.get(0).getTextEdit().getLeft().getNewText()); } + @Test + @Disabled + public void testConditionalOnPropertyCompletionWithEmptyPrefixAndEmptyNameAttribute() throws Exception { + List completions = getCompletions("@ConditionalOnProperty(prefix = , name = <*>)"); + assertEquals(3, completions.size()); + + assertEquals("data.prop2", completions.get(0).getLabel()); + assertEquals("else.prop3", completions.get(1).getLabel()); + assertEquals("spring.boot.prop1", completions.get(2).getLabel()); + } + + @Test + @Disabled + public void testConditionalOnPropertyCompletionWithEmptyPrefixAndEmptyNameAttributeInQuotes() throws Exception { + List completions = getCompletions("@ConditionalOnProperty(prefix = , name = \"<*>\")"); + assertEquals(3, completions.size()); + + assertEquals("data.prop2", completions.get(0).getLabel()); + assertEquals("else.prop3", completions.get(1).getLabel()); + assertEquals("spring.boot.prop1", completions.get(2).getLabel()); + } + + @Test + public void testConditionalOnPropertyCompletionForPrefixWithAdditionalEmptyNameAttribute() throws Exception { + List completions = getCompletions("@ConditionalOnProperty(prefix = <*>, name = )"); + assertEquals(4, completions.size()); + + assertEquals("data", completions.get(0).getLabel()); + assertEquals("else", completions.get(1).getLabel()); + assertEquals("spring", completions.get(2).getLabel()); + assertEquals("spring.boot", completions.get(3).getLabel()); + } + private void assertCompletions(String completionLine, int noOfExpectedCompletions, int selectedProposal, String expectedCompletedLine) throws Exception { String editorContent = """ package org.test;