Skip to content

Conversation

@orpiske
Copy link
Contributor

@orpiske orpiske commented Jan 30, 2026

Summary

  • Add comprehensive unit tests for the camel-rest component
  • Increase code coverage from 0% to 68%
  • Create 21 test files with 256 tests covering all major classes

Test Coverage

Tests cover the following classes:

  • RestComponent and RestEndpoint
  • RestApiComponent and RestApiEndpoint
  • RestProducer and RestApiProducer
  • DefaultRestRegistry and DefaultRestRegistryFactory
  • RestProducerBindingProcessor and callbacks
  • Component and endpoint configurers
  • URI factories
  • REST constants

Test plan

  • All 256 tests pass
  • Code compiles without errors
  • Code formatted according to project standards

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

Copy link
Contributor

@squakez squakez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a quick look it seems that these tests are just checking the creation of the mock, asserting that some value is initialized or not null. I don't see any business logic really tested, am I wrong?

@orpiske
Copy link
Contributor Author

orpiske commented Jan 30, 2026

From a quick look it seems that these tests are just checking the creation of the mock, asserting that some value is initialized or not null. I don't see any business logic really tested, am I wrong?

indeed, it does seem to be leaning a bit too much on that. I'll mark this one as a draft ... I am still adjusting the spec for coverage and this one need further checks

@orpiske orpiske marked this pull request as draft January 30, 2026 11:38
Add unit tests for camel-rest component focusing on meaningful behavior tests:
- RestComponent URI parsing and endpoint creation
- RestEndpoint behavior and error handling
- RestProducer query parameter resolution and exchange preparation
- RestApiComponent and RestApiEndpoint creation and factory interactions
- DefaultRestRegistry service management
- RestProducerBindingProcessor and callback behavior

Tests cover:
- Error conditions and exception handling
- URI template placeholder resolution
- Query parameter substitution with optional placeholders
- Host scheme handling and normalization
- Component property propagation
- Consumer/producer creation with factories

Removed low-quality tests that only verified getters/setters or constants.
@orpiske orpiske force-pushed the ci-issue-rest-coverage branch from 50251b8 to ccef330 Compare January 30, 2026 11:50
@davsclaus
Copy link
Contributor

camel-rest is tested via other components where you use it with platform-http / jetty / undertow that has rest-dsl tests.

@squakez
Copy link
Contributor

squakez commented Jan 30, 2026

camel-rest is tested via other components where you use it with platform-http / jetty / undertow that has rest-dsl tests.

Yes. We may need to see how to account aggregate report for coverage to have a more meaningful value and don't get tricked by that 0% which is not accurate. I will work on this one.

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.

3 participants