davsclaus commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3637015943


##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+    private static final String SIMPLE_POM = """
+            <project>
+                <properties>
+                    <camel.version>4.10.0</camel.version>
+                </properties>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.camel</groupId>
+                        <artifactId>camel-core</artifactId>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.apache.camel</groupId>
+                        <artifactId>camel-http</artifactId>
+                    </dependency>
+                </dependencies>
+            </project>
+            """;
+
+    private static final String CURRENT_VERSION_POM = """
+            <project>
+                <properties>
+                    <camel.version>4.22.0</camel.version>
+                </properties>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.camel</groupId>
+                        <artifactId>camel-core</artifactId>
+                    </dependency>
+                </dependencies>
+            </project>
+            """;
+
+    private final DependencySecurityAuditTools tools = createTools();
+
+    private static DependencySecurityAuditTools createTools() {
+        DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+        t.catalogService = new CatalogService();
+        t.advisoryService = new AdvisoryService();
+        return t;
+    }
+
+    @Test
+    void shouldRequirePomContent() {
+        assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, 
null, null, null, null, null))
+                .isInstanceOf(ToolCallException.class)
+                .hasMessageContaining("pomContent is required");
+    }
+
+    @Test
+    void shouldAuditOlderVersionWithKnownCves() {
+        DependencySecurityAuditTools.AuditResult result
+                = tools.camel_dependency_security_audit(SIMPLE_POM, null, 
null, null, null, null);
+
+        assertThat(result).isNotNull();
+        assertThat(result.summary()).isNotNull();
+        assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+        assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+        assertThat(result.recommendations()).isNotNull();
+    }
+
+    @Test
+    void shouldReportCleanForCurrentVersion() {
+        DependencySecurityAuditTools.AuditResult result
+                = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, 
null, null, null, null, null);
+
+        assertThat(result).isNotNull();

Review Comment:
   This test name suggests it should verify a clean result for the current 
version, but it doesn't assert `summary().clean()`. Consider adding:
   
   ```java
   assertThat(result.summary().clean()).isTrue();
   ```
   
   or at least `assertThat(result.summary().totalCves()).isZero();`.



-- 
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]

Reply via email to