Skip to content

Commit fcb54ef

Browse files
committed
Added another test for what seemed like a bug according to regexr but it works fine...? Leaving it as is because I would have to use capturing group which have a higher load to fix it
1 parent 4096d0d commit fcb54ef

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/test/java/com/github/cameltooling/lsp/internal/completion/eip/EIPChoiceCompletionTest.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public class EIPChoiceCompletionTest extends AbstractCamelLanguageServerTest {
2222

2323
private static final String FROM_ROUTE = "from(\"timer:foo?period={{timer.period}}\")";
2424
private static final String FROM_ROUTE_WITH_LINE_BREAKS_AND_TABS
25-
= "from(\"timer:foo?period={{timer.period}}\")\n\t.bean()\n.d";
25+
= "from(\"timer:foo?period={{timer.period}}\")\n\t.bean()\n";
26+
27+
private static final String FROM_ROUTE_WITH_CHOICE_EIP_MID_WRITTEN
28+
= "from(\"timer:foo?period={{timer.period}}\")\n\t.ch\n";
2629

2730

2831
@Test
@@ -93,6 +96,20 @@ void testProvideInsertionAfterFromOnCamelRouteWithLineBreaks() throws Exception
9396
assertThat(completionItems).hasSize(1);
9497
}
9598

99+
@Test
100+
void testProvideInsertionMidWritingChoice() throws Exception {
101+
RouteTextBuilder.BlueprintContentWithPosition blueprint =
102+
RouteTextBuilder.createJavaBlueprintCamelRoute(FROM_ROUTE_WITH_CHOICE_EIP_MID_WRITTEN);
103+
104+
List<CompletionItem> completionItems = getCompletionsFor(blueprint.content, blueprint.position);
105+
completionItems = completionItems.stream().filter(
106+
completionItem -> completionItem.getLabel().startsWith("Content Based Router")
107+
).collect(Collectors.toList());
108+
109+
110+
assertThat(completionItems).hasSize(1);
111+
}
112+
96113

97114
private List<CompletionItem> getCompletionsFor(String contents, Position position) throws Exception {
98115
CamelLanguageServer camelLanguageServer = initializeLanguageServer(contents, ".java");

0 commit comments

Comments
 (0)