gnodet commented on code in PR #24858:
URL: https://github.com/apache/camel/pull/24858#discussion_r3655160380


##########
catalog/camel-report-maven-plugin/src/test/java/org/apache/camel/maven/htmlxlsx/process/CoverageResultsProcessorTest.java:
##########
@@ -181,18 +190,65 @@ public void testGenerateEipStatistics() throws 
IllegalAccessException, IOExcepti
     }
 
     @Test
-    public void testGenerateChildEipStatistics() {
+    void testGenerateChildEipStatistics() {
 
-    }
+        ChildEip childEip = new ChildEip();
 
-    @Test
-    public void testGenerateExcel() {
+        // Add an EipAttribute entry (simulates a child EIP node with coverage 
data)
+        EipAttribute eipAttribute = new EipAttribute();
+        eipAttribute.setId("setBody");
+        eipAttribute.setIndex(5);
+        eipAttribute.setExchangesTotal(3);
+        eipAttribute.setTotalProcessingTime(42);
+        Properties props = new Properties();
+        props.put("uri", "direct:test");
+        eipAttribute.setProperties(props);
+        childEip.getEipAttributeMap().put("setBody", eipAttribute);
+
+        // Add a String entry (simulates a simple property like a constant 
expression)
+        childEip.getEipAttributeMap().put("constant", "Hello World");
+
+        ChildEipStatistic childEipStatistic = new ChildEipStatistic();
 
+        processor.generateChildEipStatistics(childEip, childEipStatistic);
+
+        Map<Integer, EipStatistic> resultMap = 
childEipStatistic.getEipStatisticMap();
+
+        assertAll(
+                () -> assertNotNull(resultMap),
+                () -> assertEquals(2, resultMap.size()),
+                // EipAttribute entry: keyed by index=5, tested because 
exchangesTotal > 0
+                () -> assertNotNull(resultMap.get(5)),
+                () -> assertEquals("setBody", resultMap.get(5).getId()),
+                () -> assertTrue(resultMap.get(5).isTested()),
+                () -> assertEquals(42, 
resultMap.get(5).getTotalProcessingTime()),
+                // String entry: keyed by 0, wraps value in Properties
+                () -> assertNotNull(resultMap.get(0)),
+                () -> assertEquals("constant", resultMap.get(0).getId()),
+                () -> assertEquals("Hello World", 
resultMap.get(0).getProperties().get("value")));
     }
 
     @Test
-    public void testGenerateHtml() {
+    void testGenerateHtml() throws IllegalAccessException, IOException {
+
+        Mockito
+                .doNothing()
+                .when(processor).writeDetailsAsHtml(any(RouteStatistic.class), 
any(File.class));
+
+        @SuppressWarnings("unchecked")
+        Map<String, RouteStatistic> routeStatisticMap
+                = (Map<String, RouteStatistic>) 
FieldUtils.readDeclaredField(processor, "routeStatisticMap", true);
+
+        RouteStatistic stat1 = new RouteStatistic();
+        stat1.setId("route1");
+        RouteStatistic stat2 = new RouteStatistic();
+        stat2.setId("route2");
+        routeStatisticMap.put("route1", stat1);
+        routeStatisticMap.put("route2", stat2);
 
+        processor.generateHtml(htmlPath());
+
+        Mockito.verify(processor, 
Mockito.times(2)).writeDetailsAsHtml(any(RouteStatistic.class), 
any(File.class));

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Renamed to `testHtmlGenerationCalledWhenHtmlFormatAsked` as suggested.



##########
components/camel-ai/camel-langchain4j-embeddingstore/src/test/java/org/apache/camel/component/langchain4j/embeddings/LangChain4jEmbeddingStoreComponentTest.java:
##########
@@ -51,16 +53,16 @@ protected CamelContext createCamelContext() throws 
Exception {
     }
 
     @Test
-    public void testSimpleEmbedding() {
-
+    public void testSimpleEmbedding() throws Exception {
         EmbeddingModel embeddingModel = new AllMiniLmL6V2EmbeddingModel();
 
         TextSegment segment1 = TextSegment.from("I like football.");
         Embedding testEmbedding = embeddingModel.embed(segment1).content();
+        assertNotNull(testEmbedding, "embedding model should produce a 
non-null embedding");
 
         Message first = fluentTemplate.to("langchain4j-embeddingstore:first")
                 .withBody(testEmbedding)
                 .request(Message.class);
-
+        assertNotNull(first, "response message should not be null");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Good point — there is indeed a Weaviate test container available. Looking at 
the codebase, `LangChain4jEmbeddingStoreComponentWeaviateTargetIT` already 
covers store-level testing with Weaviate test infra. The disabled 
`testStoreRouting` test was redundant, so I've removed it. This unit test now 
focuses on the embedding model (which doesn't need infrastructure), and the IT 
covers the full store routing.



##########
components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpTcpClientProducerRequiredEndOfDataWithoutValidationTest.java:
##########


Review Comment:
   _Claude Code on behalf of gnodet_
   
   You're right — the try-catch wrapping in `RuntimeCamelException` was worse 
than the original. `assertDoesNotThrow` IS a valid assertion for S2699 and was 
already more expressive. Reverted back to `assertDoesNotThrow` style.



##########
components/camel-mllp/src/test/java/org/apache/camel/test/executor/PooledExecutorTest.java:
##########
@@ -54,6 +57,9 @@ public void testAddRunnable() throws Exception {
 
         log.info("Starting second set of runnables");
         startRunnables(runnableCount, runCount);
+
+        assertNotNull(instance.executor, "Executor should still be active 
after submitting runnables");
+        assertFalse(instance.executor.isShutdown(), "Executor should not be 
shut down after submitting runnables");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — `startRunnables` now returns the list of accepted runnables, and 
the test verifies the pool's behavior: first batch accepts up to THREAD_COUNT 
runnables (SynchronousQueue constraint), second batch is fully rejected because 
threads are still busy.



##########
components/camel-netty/src/test/java/org/apache/camel/component/netty/MainNettyCustomCodecTest.java:
##########
@@ -56,7 +59,11 @@ public void configure() {
         });
         main.configure().withDurationMaxMessages(2);
         main.configure().withDurationMaxSeconds(5);
+
         main.run();
+        // run() blocks until duration/message limit is reached, then returns.
+        // The route processor inside validates data equality and throws if 
mismatched.
+        assertNotNull(main.getCamelContext(), "CamelContext should have been 
created during run");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — added an `AtomicBoolean routeProcessed` that the route processor 
sets after validating the custom-codec data. The test now asserts 
`assertTrue(routeProcessed.get())` to verify the route actually processed and 
validated the message.



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