-
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
Filter.matchMethodDescription(Description) has confusing behavior #1317
Comments
@Reissner would you be willing to send us a pull request that improves the Javadoc? |
Also your description of the current behavior doesn't match the code (see https://github.com/junit-team/junit4/blob/master/src/main/java/org/junit/runner/manipulation/Filter.java). Does the test you are trying to filter use a |
Nevermind, I see your point about the behavior. |
I think, it is not the point to improve the documentation, If you agree with documentation the according documentation should be something like Filter.matchMethodDescription(desiredDescription) |
It's unclear to me what this should do if you pass a suite Description. Firstly, they are hard to build (it needs to include all children and grandchildren, etc). Secondly, if the request was previously filtered, then the suite you pass in may no longer match anything. I can think of two options: a. If you pass in a suite it should throw |
I digged a little bit more into and now I think, the problem is elsewhere: Otherwise, if description contains at least one leaf description descL which passes the filter, This interpretation is the only possible one Also in method ParentRunner.filter(Filter) Summarizing, Filter.matchMethodDescription(final Description) is perfectly ok |
I think it's perfectly fine for |
Oh, no! not at all. It is possible to return true on any suite but it makes bad performance... |
I am also not sure that As for the Javadoc suggestion, I have a counter proposal: create a subclass of |
Now that i understood the principle, i think the implementation of My problem was that I misunderstood the intention behind Filter.shouldRun. There are several places in the code supporting this view: |
Again, instead of updating the Filter Javadoc to describe a complicated algorithm for creating a filter that matches on leaf nodes, why don't we add to JUnit an abstract Filter implementation that implements that algorithm? |
I think the documentation of this method is misleadinig.
What it really does is:
If desiredDescription does not describe a single test, no test is executed at all.
If desiredDescription describes a single test, then each description is run containing this single test.
I think this is not what is documented and also it is not what is wanted:
it is used in
Request.filterWith(final Description desiredDescription)
The text was updated successfully, but these errors were encountered: