davsclaus opened a new pull request, #29922: URL: https://github.com/apache/camel/pull/29922
Item 2 of [CAMEL-26933](https://issues.apache.org/jira/browse/CAMEL-26933). ## Problem `camel test init` (`TestInit`, which extends the Citrus `Init`) has no existence check and no `--force`. Running it again silently replaces an edited test: the Citrus `Init` writes the template with `Files.writeString`. `camel init` refuses with "File already exists: ... (use --force to overwrite it)". ## Change - `TestInit.call()` refuses when the test file exists: "Error: Test already exists: <file> (use --force to overwrite it)", exit 1. The wording follows `camel init`, in the `Error:` style of the Citrus init messages. - A new `--force` option overwrites, as before. - The file is worked out the way the Citrus `Init` does: its file argument in `resolveTargetDirectory(--directory)`. The file argument goes through a Citrus parameter consumer into the private field `file` of `Init`, so it is read from there. If a future Citrus version no longer has that field, there is no check, and the command behaves as before rather than failing. ## Tests - `TestPluginTest.initDoesNotOverwriteATest`: init, edit the test, init again (refused, the edit stays, the message is printed), then `--force` (overwritten). It runs the `camel test init` command line, as the other tests of the class do. - camel-jbang-plugin-test: 7 tests pass. Item 8 of the JIRA (two tests with the same base name, `TestPluginExporter`) waits for #29857, which changes `TestPluginExporter`. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
