ammachado opened a new pull request, #23812: URL: https://github.com/apache/camel/pull/23812
# Description Adds test coverage for `camel-jbang-core` CLI commands to prepare the codebase for a refactoring pass ([CAMEL-23688](https://issues.apache.org/jira/browse/CAMEL-23688)). Before this PR, `commands/process/` had zero tests and `commands/action/` had only 2 test classes for 38+ command files. **Approach for process commands** (`ListProcess`, `CamelRouteStatus`, `ListEndpoint`, etc.): mock the JDK static methods `ProcessHandle.allProcesses()` and `ProcessHandle.current()` with Mockito 5's `mockStatic`, then write hand-crafted `<pid>-status.json` fixtures via `CommandLineHelper.useHomeDir()`. This exercises the full table-rendering, sorting, filtering, and JSON-output paths without a running Camel integration. **Approach for action commands**: pure unit tests against public/package-private utility methods, and an inner test-subclass pattern (already established in this module by `CamelRouteDiagramActionTest`) that overrides `findPids()` and `waitForOutputFile()` to inject a prepared JSON response. **New files:** `commands/` package: - `CamelCommandHelperTest` — phase integer to human-readable status string mapping `commands/action/` package: - `CamelStartupRecorderActionTest` — step display, name parentheses, sort by duration, empty-pid error - `LoggerActionTest` — logger list display, sort by context name across two processes - `MessageTableHelperTest` — body/header visibility toggle, null root, exchange ID in output - `CamelSourceActionTest` — `extractSourceName()` edge cases (null, plain file, scheme, path, multi-colon) `commands/process/` package: - `ProcessCommandTestSupport` — shared base: MockedStatic wiring, status-file helpers, JSON builders - `CamelContextStatusTest` — Running/Starting/Stopped phase display, JSON output - `CamelRouteStatusTest` — single/multiple routes, suspended route, filter, limit, JSON output - `ListProcessTest` — table display, sort by pid/name/age, name filter, reload-error display, JSON output - `ListEndpointTest` — URI display, direction filter (from/to), JSON output - `ListHealthTest` — UP/DOWN health check display, readiness-only filter, JSON output - `ListRestTest` — REST endpoint URL/method display, JSON output - `ListConsumerTest` — consumer URI/state display, JSON output - `ListErrorTest` — error display from `<pid>-error.json`, routeId, JSON output - `ListVariableTest` — variable key/value/scope display, JSON output - `ListMetricTest` — counter metric display (`all=true`), JSON output - `ListCircuitBreakerTest` — CLOSED/OPEN state display, JSON output **Test count:** 525 total in this module (previously ~470), 0 failures, 0 errors. _Claude Code on behalf of Adriano Machado_ # 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-23688) 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. -- 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]
