ammachado opened a new pull request, #24204: URL: https://github.com/apache/camel/pull/24204
# Description Continues the CAMEL-23688 effort to build a regression safety net around the `camel-jbang` CLI commands before a planned refactor. After the `action/` package was covered (PRs #24188, #24189, #24199), this PR moves to the next-largest untested cluster, `commands/catalog/`, which previously had a single test (`CatalogDocTest`). Adds unit tests for the six offline catalog listing commands, each extending `CatalogBaseCommand` and loading the bundled `DefaultCamelCatalog`: - `CatalogComponentTest` (component) - lists `kafka`; `--filter` narrowing; `--json` output; no-match `--filter` suggestion branch. - `CatalogDataFormatTest` (dataformat) - lists `jaxb`; `--filter` narrowing. - `CatalogLanguageTest` (language) - lists `simple`; `--filter` narrowing. - `CatalogOtherTest` (other) - lists `cli-connector`; `--filter` narrowing. - `CatalogTransformerTest` (transformer) - lists `application-octet-stream`; `--filter` narrowing. - `CatalogDevConsoleTest` (dev-console) - lists `context`; `--filter` narrowing. The tests need no `ProcessHandle`/status-file harness: they construct the command directly (mirroring `CatalogDocTest`), set the `--sort` option that picocli would otherwise default, run `doCall()`, and assert specific catalog entries in the rendered output. ## Bug fixed The transformer `--filter` test surfaced a real, pre-existing `NullPointerException`: `camel catalog transformer --filter=<anything>` crashed because `CatalogBaseCommand`'s filter predicate dereferenced the row's `description` and `label` without a null check. Transformer catalog models legitimately have a `null` description and label (unlike component/dataformat/language/other/dev-console), so the command was unusable with a filter. The filter now null-guards both fields, which covers all six listing commands and any future `collectRows` implementation. ## Out of scope (deferred) `CatalogKamelet` downloads `camel-kamelets-catalog` from Maven and reflectively loads `KameletsCatalog`; offline, a unit test reaches only its `catch -> return 1` branch, so it needs an integration-style test and is not included here. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. --- _Claude Code on behalf of Adriano Machado_ -- 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]
