This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 6dbcf0b2b816 CAMEL-25382: Fix SemanticCompletionTest after question 
renamed to evaluation
6dbcf0b2b816 is described below

commit 6dbcf0b2b816b8444ba767780bef8d8156317264
Author: Aurélien Pupier <[email protected]>
AuthorDate: Thu Oct 8 14:42:59 2026 +0200

    CAMEL-25382: Fix SemanticCompletionTest after question renamed to
    evaluation
    
    PR #27494 (CAMEL-25382) restructured the semantic YAML DSL node:
    - renamed the named map key from 'question' to 'evaluation'
    - replaced the typed sub-schemas (BooleanSchema / ChoiceSchema /
    ScoreSchema)
      with a single EvaluationSchema, dropping enum constraints on 'type'
    and
      'uncertaintyPolicy'
    
    Update the test accordingly:
    - use 'evaluation:' instead of 'question:' in the YAML fixture
    - update expected paths from /semantic/question/... to
    /semantic/evaluation/...
    - drop the type-enum assertion (boolean/choice/score) since 'type' is
    now a
      free-form string with no enum values in the schema
    - rename the test method to
    completionFollowsNamedEvaluationMapAndOffersVariantFields
    - migrate all assertions from JUnit 5
    assertTrue/assertFalse/assertEquals to
      AssertJ for richer failure messages
    
    Co-authored-by: IBM Bob 2.2.1
    Signed-off-by: Aurélien Pupier <[email protected]>
---
 .../core/commands/tui/SemanticCompletionTest.java  | 40 ++++++++++------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticCompletionTest.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticCompletionTest.java
index b09aad80e258..451da0e333b5 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticCompletionTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticCompletionTest.java
@@ -20,14 +20,11 @@ import java.util.List;
 import java.util.concurrent.atomic.AtomicReference;
 
 import dev.tamboui.widgets.input.TextAreaState;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.CsvSource;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 class SemanticCompletionTest {
     private SourceEditAssist assist() {
@@ -37,24 +34,23 @@ class SemanticCompletionTest {
                         new AtomicReference<List<InfraInfo>>(List.of())));
     }
 
-    @Disabled("CAMEL-25382 renamed semantic question to evaluation and changed 
the YAML DSL model the completion reads")
     @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
@@ -63,11 +59,11 @@ class SemanticCompletionTest {
                 "- route:\n    from:\n      uri: direct:start\n      steps:\n  
      - log:\n            ");
         SourceEditorNavigation.positionCursor(state, 5, 12);
         String path = new YamlSourceContext(state).findParentYamlPath(5);
-        assertEquals("/route/from/steps/log", path);
+        assertThat(path).isEqualTo("/route/from/steps/log");
         SourceEditAssist assist = assist();
-        assertEquals(assist.provideTreeCompletions("log"), 
assist.provideTreeCompletions(path));
-        assertEquals(assist.provideTreeValueCompletions("log:loggingLevel"),
-                assist.provideTreeValueCompletions(path + ":loggingLevel"));
-        assertFalse(assist.provideTreeValueCompletions(path + 
":loggingLevel").isEmpty());
+        
assertThat(assist.provideTreeCompletions(path)).isEqualTo(assist.provideTreeCompletions("log"));
+        assertThat(assist.provideTreeValueCompletions(path + ":loggingLevel"))
+                
.isEqualTo(assist.provideTreeValueCompletions("log:loggingLevel"));
+        assertThat(assist.provideTreeValueCompletions(path + 
":loggingLevel")).isNotEmpty();
     }
 }

Reply via email to