Skip to content

Conversation

@orpiske
Copy link
Contributor

@orpiske orpiske commented Jan 24, 2026

More assertion modernization in tests

@github-actions
Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@orpiske orpiske force-pushed the ci-camel-4-camel-21196-components branch 2 times, most recently from 0a04939 to b0bc349 Compare January 24, 2026 20:40
@orpiske
Copy link
Contributor Author

orpiske commented Jan 24, 2026

This is way too big. I will break it in smaller pieces.

@orpiske orpiske force-pushed the ci-camel-4-camel-21196-components branch 3 times, most recently from 97fa7b8 to 313d38a Compare January 25, 2026 07:10
Convert try-catch-fail pattern to JUnit 5 assertThrows() in AvroMarshalAndUnmarshalTest.
Replace JUnit 3 style fail() call with modern JUnit 5 assertTrue()
assertion with error message in ExecJava8IssueTest.

Changes:
- Updated import from Assertions.fail to Assertions.assertTrue
- Converted fail("message") to assertTrue(condition, "message")
Convert try-catch-fail patterns to modern JUnit 5 assertThrows() in test files:
- GroovyLanguageTest.java
- GroovyExpressionTest.java
- GroovyLogEipTest.java

Updated imports to replace fail with assertThrows for better readability and
modern testing patterns.
Replace try-catch-fail pattern with JUnit 5 assertThrows() in
GraphqlComponentTest.checkThrowException() test method. Updated
imports to use assertThrows instead of fail.
Convert try-catch-fail patterns to JUnit 5 assertThrows in CryptoDataFormatTest.
Replaced legacy fail() with assertThrows() for cleaner and more idiomatic exception testing.
Replace all try-catch-fail patterns with modern JUnit 5 assertThrows() patterns in:
- OriginalSimpleTest.java (49 fail() calls converted)
- OriginalSimpleOperatorTest.java (12 fail() calls converted)

Updated imports: removed fail, added assertThrows
…parsers

Converted try-catch-fail patterns to JUnit 5 assertThrows in 6 test files:
- UniVocityCsvDataFormatUnmarshalTest
- UniVocityCsvDataFormatUnmarshalSpringTest
- UniVocityFixedDataFormatUnmarshalTest
- UniVocityFixedDataFormatUnmarshalSpringTest
- UniVocityTsvDataFormatUnmarshalTest
- UniVocityTsvDataFormatUnmarshalSpringTest

Replaced fail() import with assertThrows and converted all
try-catch blocks to lambda-based assertThrows calls.
Replace try-catch-fail pattern with assertDoesNotThrow and assertThrows
for more idiomatic JUnit 5 exception testing in KinesisConsumerClosedShardWithFailTest.
Also removed unused fail() import.
Replace try-catch-fail pattern with assertThrows in JpaProducerNoBodyTest.
Replace try-catch-fail patterns with assertThrows in:
- JaxbDataFormatMustBeJAXBElementTest
- CamelJaxbFallbackConverterTest
- NonXmlCharFiltererTest
Replace try-catch-fail pattern with assertThrows in JdbcOptionsTest.
Replace try-catch-fail patterns with assertThrows in:
- JMXEndpointTest (9 occurrences)
- JMXRobustRemoteConnectionTest (1 occurrence)
- JMXComponentTest (3 occurrences)
Replace try-catch-fail patterns with assertThrows in:
- FhirJsonDataformatErrorHandlerTest
- FhirXmlDataformatErrorHandlerTest
- FhirJsonDataformatErrorHandlerSpringTest
- FhirXmlDataformatErrorHandlerSpringTest
Replace try-catch-fail patterns with assertThrows in:
- HttpClientRouteTest.java (2 occurrences)
- MultiServletConsumerTest.java (2 occurrences)
- ServletChoiceBeanTest.java (1 occurrence)
Replace try-catch-fail patterns with assertThrows in test classes to use
modern JUnit 5 exception testing approach, improving code clarity and consistency.
Replace try-catch-fail patterns with assertThrows in:
- ProtobufMarshalAndUnmarshalSpringTest.java (1 occurrence)
- ProtobufMarshalAndUnmarshalTest.java (1 occurrence)
Replace try-catch-fail patterns with assertThrows in all test files.
Modernizes exception handling assertions to use JUnit 5 best practices.

Files changed:
- SecurityProviderHttpHandlerTest.java
- SecurityProviderNoAcceptanceTest.java
- SecurityProviderRolesFromComponentTest.java
- SecurityProviderTest.java
- SecurityProviderWithoutProviderTest.java
- RestUndertowMethodNotAllowedTest.java
- RestUndertowHttpBindingModeXmlTest.java
- UndertowSuspendResumeTest.java
- UndertowError500Test.java
- UndertowHandlersSpringTest.java
- UndertowHttp2Test.java
- UndertowPrefixMatchingTest.java
- DefaultUndertowHttpBindingTest.java
- UndertowConsumerUnregisterTest.java
Replace try-catch-fail patterns with assertThrows in test classes to use
modern JUnit 5 exception testing approach, improving code clarity and consistency.
Replace try-catch-fail patterns with simple throws in Sjms2EndpointTest.java:
- testDefaultExchangePattern
- testInOnlyExchangePattern
- testInOutExchangePattern
Replace try-catch-fail patterns with assertThrows in:
- WorkdayCommonAPIProducerTest.java (2 occurrences)
- WorkdayReportProducerTest.java (1 occurrence)
Replace try-catch-fail patterns with assertThrows where applicable and convert
fail() calls to throw new AssertionError() in test classes to use modern
JUnit 5 exception testing approach, improving code clarity and consistency.
Replace try-catch-fail patterns with assertThrows in:
- SaxonXsltFeatureRouteTest.java (1 occurrence)
- SaxonInvalidXsltFileTest.java (1 occurrence)
Replace try-catch-fail patterns with assertThrows in test classes to use
modern JUnit 5 exception testing approach, improving code clarity and consistency.
…ttp-vertx

Replace try-catch-fail patterns with JUnit 5 assertThrows for modernized exception testing.
Replace fail(e) pattern with throw new AssertionError for modernized exception handling.
@orpiske orpiske force-pushed the ci-camel-4-camel-21196-components branch from 313d38a to 0003152 Compare January 25, 2026 12:55
@orpiske
Copy link
Contributor Author

orpiske commented Jan 25, 2026

Undertow failures are unrelated to this, so it's OK to merge.

@orpiske orpiske merged commit 0d793d3 into apache:main Jan 25, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant