[ 
https://issues.apache.org/jira/browse/CAMEL-24989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-24989:
--------------------------------
    Fix Version/s: 4.x

> Overridden test methods without @Test are silently skipped in 
> SpringSamplingThrottlerTest and an MLLP test
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24989
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24989
>             Project: Camel
>          Issue Type: Test
>          Components: camel-mllp, camel-spring-xml
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.x
>
>
> In JUnit 5, a method that overrides a {{@Test}} method is only a test if it 
> declares {{@Test}} itself. The annotation is not inherited. A subclass that 
> overrides a test without {{@Test}} silently drops it: the test never runs and 
> still shows as green.
> A scan of all test sources found two classes where this is not intentional 
> (overrides that use {{@Disabled}} on purpose, such as in 
> {{SpringLoopDoWhileTest}} and {{SpringXmlRouteBuilderTest}}, are fine):
> *camel-spring-xml* - {{SpringSamplingThrottlerTest}}
> All 6 overrides lack {{@Test}}: testSamplingFromExchangeStream, 
> testBurstySampling, testSendLotsOfMessagesSimultaneouslyButOnly3GetThrough, 
> testSamplingWithPropertyPlaceholder, testSamplingUsingMessageFrequency, 
> testSamplingUsingMessageFrequencyViaDSL. They only call super, so they can be 
> removed. Some routes they need are also missing from 
> {{samplingThrottler.xml}}, for example {{direct:sample-placeholder}}, so the 
> tests will fail once they run until those routes are added.
> *camel-mllp* - {{MllpTcpServerConsumerOptionalEndOfDataWithoutValidationTest}}
> 7 overrides with their own expectations lack {{@Test}}: testInvalidMessage, 
> testNthInvalidMessage, testMessageContainingEmbeddedStartOfBlock, 
> testNthMessageContainingEmbeddedStartOfBlock, 
> testMessageContainingEmbeddedEndOfBlock, 
> testNthMessageContainingEmbeddedEndOfBlock, 
> testInvalidMessageContainingEmbeddedEndOfBlock. The sibling classes that 
> extend {{TcpServerConsumerEndOfDataAndValidationTestSupport}} do declare 
> {{@Test}} on their overrides.
> Found while fixing a CI failure after CAMEL-24927, where the new inherited 
> test was the only one that actually ran in {{SpringSamplingThrottlerTest}}.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to