gnodet-bot commented on code in PR #27571:
URL: https://github.com/apache/camel/pull/27571#discussion_r4219127676
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticCompletionTest.java:
##########
@@ -37,22 +35,22 @@ private SourceEditAssist assist() {
}
@ParameterizedTest
- @CsvSource({ "department,/semantic/question/department",
"support/team,/semantic/question/support%2Fteam" })
- void completionFollowsNamedQuestionMapAndOffersVariantFields(String
question, String expectedPath) {
- TextAreaState state = new TextAreaState("- semantic:\n question:\n
" + question + ":\n ");
+ @CsvSource({ "department,/semantic/evaluation/department",
"support/team,/semantic/evaluation/support%2Fteam" })
+ void completionFollowsNamedEvaluationMapAndOffersVariantFields(String
evaluation, String expectedPath) {
+ TextAreaState state = new TextAreaState("- semantic:\n
evaluation:\n " + evaluation + ":\n ");
SourceEditorNavigation.positionCursor(state, 3, 8);
String path = new YamlSourceContext(state).findParentYamlPath(3);
- assertEquals(expectedPath, path);
+ assertThat(path).isEqualTo(expectedPath);
SourceEditAssist assist = assist();
List<String> keys =
assist.provideTreeCompletions(path).stream().map(AutocompletePopup.CompletionItem::key).toList();
- assertTrue(keys.containsAll(List.of("type", "instructions", "state",
"criteria", "threshold", "uncertaintyPolicy")),
- keys.toString());
- assertFalse(assist.provideTreeCompletions(path +
":instructions").stream()
- .anyMatch(item -> item.key().equals("instructions")));
- List<String> types = assist.provideTreeValueCompletions(path +
":type").stream()
- .map(AutocompletePopup.CompletionItem::key).toList();
- assertTrue(types.containsAll(List.of("boolean", "choice", "score")),
types.toString());
-
assertFalse(String.valueOf(assist.getTreeNode("semantic").get("label")).contains("language"));
+ assertThat(keys).as("completions for path %s", path)
+ .contains("type", "instructions", "state", "criteria",
"threshold", "uncertaintyPolicy");
+ assertThat(assist.provideTreeCompletions(path + ":instructions"))
+ .as("instructions already present — should be filtered out")
+ .noneMatch(item -> item.key().equals("instructions"));
+ assertThat(String.valueOf(assist.getTreeNode("semantic").get("label")))
+ .as("semantic node label should not mention language")
+ .doesNotContain("language");
}
@Test
Review Comment:
⚠️ **Dropped assertion during AssertJ migration** — the original code also
verified that `provideTreeValueCompletions(path + ":type")` returns at least
`"boolean"`, `"choice"`, `"score"`:
```java
List<String> types = assist.provideTreeValueCompletions(path +
":type").stream()
.map(AutocompletePopup.CompletionItem::key).toList();
trusted.containsAll(List.of("boolean", "choice", "score"))
```
That assertion is gone — nothing in the new code exercises the enum
completions for the `:type` field. Please restore it:
```suggestion
assertThat(keys).as("completions for path %s", path)
.contains("type", "instructions", "state", "criteria",
"threshold", "uncertaintyPolicy");
List<String> types = assist.provideTreeValueCompletions(path +
":type").stream()
.map(AutocompletePopup.CompletionItem::key).toList();
assertThat(types).as("type field should offer boolean/choice/score
completions")
.contains("boolean", "choice", "score");
assertThat(assist.provideTreeCompletions(path + ":instructions"))
.as("instructions already present — should be filtered out")
.noneMatch(item -> item.key().equals("instructions"));
assertThat(String.valueOf(assist.getTreeNode("semantic").get("label")))
.as("semantic node label should not mention language")
.doesNotContain("language");
```
(Same gap exists in #27570.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]