Skip to content
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 Ant/Maven style classname filters #4

Open
cdman opened this issue Apr 28, 2015 · 5 comments
Open

Add Ant/Maven style classname filters #4

cdman opened this issue Apr 28, 2015 · 5 comments

Comments

@cdman
Copy link
Contributor

cdman commented Apr 28, 2015

The current implementation of @ClassnameFilters uses regex for filtering which frequently requires double-escaping strings and also is less common than Ant/Maven style filters (where "" means "anything except for dot" and "*" means anything, including dots).

For example the same filter would be encoded as:

  • Regex: "com.example..*Test"
  • Ant/Maven: "com.example.*Test"

Could we have support for the second version? Perhaps as a different field on @ClassnameFilters or a different annotation? (like @AntClassnameFilters)

@jvanzyl
Copy link
Contributor

jvanzyl commented Apr 28, 2015

Sure, I think if you take a look at the necessary Ant utilities you can probably graft those in.

@cdman
Copy link
Contributor Author

cdman commented Apr 30, 2015

Let me know how you would like to add it (add a new property in ClassnameFilter? Create a separate annotation? Add a flag? Change the default?) and I'll try to come up with a pull-request.

AFAIK maven-surefire uses MatchPatterns, but perhaps that's too big of a dependency to pull in just for this - the actual code should be around ~20 lines.

@jvanzyl
Copy link
Contributor

jvanzyl commented Apr 30, 2015

I think changing the default behaviour and using the same patterns as Surefire/Ant would be useful. Then we can point people at existing documentation. We can bump the major version and I'm not sure many people use this library so I think changing the default behaviour is fine.

@scotNZ
Copy link

scotNZ commented Aug 30, 2017

I'm not sure if cpsuite documentation has been amended to reflect this change. I personally find the whole subject of matching on qualified class names extremely confusing. The maven surefire documents (if they correspond to the changes made in cpsuite) are also confusing. Some clarity and working examples would be good.

@xpomul
Copy link

xpomul commented Sep 15, 2021

There is an off-by-one error in the current code.
"**.*Test" will also match my.example.MyXest".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants