Skip to content

Commit

Permalink
Added another test for what seemed like a bug according to regexr but…
Browse files Browse the repository at this point in the history
… it works fine...? Leaving it as is because I would have to use capturing group which have a higher load to fix it
  • Loading branch information
joshiraez committed Jan 9, 2023
1 parent 4096d0d commit fcb54ef
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public class EIPChoiceCompletionTest extends AbstractCamelLanguageServerTest {

private static final String FROM_ROUTE = "from(\"timer:foo?period={{timer.period}}\")";
private static final String FROM_ROUTE_WITH_LINE_BREAKS_AND_TABS
= "from(\"timer:foo?period={{timer.period}}\")\n\t.bean()\n.d";
= "from(\"timer:foo?period={{timer.period}}\")\n\t.bean()\n";

private static final String FROM_ROUTE_WITH_CHOICE_EIP_MID_WRITTEN
= "from(\"timer:foo?period={{timer.period}}\")\n\t.ch\n";


@Test
Expand Down Expand Up @@ -93,6 +96,20 @@ void testProvideInsertionAfterFromOnCamelRouteWithLineBreaks() throws Exception
assertThat(completionItems).hasSize(1);
}

@Test
void testProvideInsertionMidWritingChoice() throws Exception {
RouteTextBuilder.BlueprintContentWithPosition blueprint =
RouteTextBuilder.createJavaBlueprintCamelRoute(FROM_ROUTE_WITH_CHOICE_EIP_MID_WRITTEN);

List<CompletionItem> completionItems = getCompletionsFor(blueprint.content, blueprint.position);
completionItems = completionItems.stream().filter(
completionItem -> completionItem.getLabel().startsWith("Content Based Router")
).collect(Collectors.toList());


assertThat(completionItems).hasSize(1);
}


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

0 comments on commit fcb54ef

Please sign in to comment.