-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 BlockJUnit4ClassRunner#createTest(FrameworkMethod) #1037
Conversation
…FrameworkMethod) to allow implementations to provide a custom instance of the test for each FrameworkMethod invocation
Thanks for the pull. Can you think of a test that would cover this change? |
…eing overridden successfully
I've updated the pull request with two tests:
Neither seem particularly neat, but hopefully they're suitable |
…ault by BlockJUnit4ClassRunner#createTest(FrameworkMethod)
Travis marked this pull as failing on oraclejdk7 under Linux, it looks from the build log that it was a problem pulling down the dependencies (perhaps due to increased load after the DNS outage that impacted Travis?), but I forced a re-build anyway by amending the commit to get a different git rev id, Travis is now showing green. |
@petergeneric Thank you for the pull requests. I squashed your commits and merged your changes into master in bd5b90f. |
@petergeneric Can you please add a short description to https://github.com/junit-team/junit/wiki/4.13-Release-Notes? |
Thanks, I've added a section in the release notes. |
Perfect, thanks again! |
Maybe you had some reason in Guice and maybe this could be solved other way, |
@Tibor17 I don't understand the concern. Peter had a perfectly reasonable need to have the FrameworkMethod passed in. The change doesn't make the code harder to maintain because we need it for other reasons. Peter documented the methods clearly. This class is full of methods that are only exist and/or only are visible to enable extension points. The alternative proposed by Peter would lead to a lot of duplicate code on his side. Did you have another alternative? |
I know it's not that easy to find cool hook within few minutes, but take a look at these two signatures. Many developers don't read documentations because they rely on proper API design. I think that's still correct attitude of developers due to the code should be self explaining just as you read the names of methods or classes. No need to read any additional text in documentation saying that this method defaults to another one. And what happened. |
@Tibor17 I don't have a lot of sympathy for developers who don't read documentation, but I do like self-describing APIs. So your concern is that this method should have a different name? If so, can you suggest a better name? If giving the method a different name wouldn't resolve your concern, then could you give us a specific suggestion? Incidentally, a completely different solution would be something like TestNG's Factory annotation (possibly as a meta-annotation) so Peter could add this functionality without requiring his users to use a specific runner. |
We could deprecate |
Of course deprecating the method is one solution. |
Removing the method is likely to break many people. Is it really worth the pain? I don't see a large benefit to removing the method. |
@Tibor17 Do you want us to go back to month-long pull requests? 😏 |
We have informally decided that we would not remove a deprecated API until two years after the release where it was deprecated, and we would only remove the APIs in a major version. |
Adding BlockJUnit4ClassRunner#createTest(FrameworkMethod) to allow implementations to provide a custom instantiation of the test class for each FrameworkMethod invocation - see issue #1036