-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'throws Exception' to generated Java stepdef snippets #318
Comments
That makes total sense. |
Seems I don't know how to make pull requests - issue 319 was created for this as well. :( |
Why did you choose to throw Throwable over Exception? Only classes deriving from Exception have to be added to the signature. |
I can't remember now. throwing Exception should be fine. |
So wouldn't it be more appropriate to output "throw Exception" in the generated snippets? Or do you avoid that change as it doesn't look well in already established test suites? |
Your suggestion sounds good. Please send a PR |
Tests are allowed to fail by throwing an(y) exception. As such #318 added `throws Throwable` to the JavaSnippet. Aside from being a bad practice this results in unnecessary checkstyle warnings. As such the generated snippet should not explicitly declare `Throwable`. Reducing `Throwable` to `Exception` should be sufficient. Fixes #1207
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The convention (or my convention at least - I think it is general) when writing unit tests is to have method signatures like this:
This means you don't need to worry about catching any checked exceptions, and is a statement that 'any exceptions thrown out of this test means the test should fail'.
I think it is a good idea to do the same with step definitions. Would it make sense to add 'throws Exception' to the method signatures in Java snippets? I'll be happy to submit some code if so.
The text was updated successfully, but these errors were encountered: