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

Extend syntax for simple class name handling #41

Closed
codecholeric opened this issue Nov 5, 2017 · 1 comment · Fixed by #43
Closed

Extend syntax for simple class name handling #41

codecholeric opened this issue Nov 5, 2017 · 1 comment · Fixed by #43
Assignees
Milestone

Comments

@codecholeric
Copy link
Collaborator

codecholeric commented Nov 5, 2017

While one can do pretty much any filtering / assertion on class names using haveNameMatching(regex), common use cases are to check the simple name for endsWith, startsWith or contains.
These cases should be directly represented within the syntax, without thinking in regex. Thus we should add classes().

  • that().haveSimpleNameEndingWith(..)
  • that().haveSimpleNameStartingWith(..)
  • that().haveSimpleNameContaining(..)
  • should().haveSimpleNameEndingWith(..)
  • should().haveSimpleNameStartingWith(..)
  • should().haveSimpleNameContaining(..)

and the respective negations (notHave...)

@codecholeric
Copy link
Collaborator Author

Thanks to @SteluHH by now there are already

  • should().haveSimpleNameEndingWith(..) / should().notHaveSimpleNameEndingWith(..)
  • should().haveSimpleNameStartingWith(..) / should().notHaveSimpleNameStartingWith(..)

codecholeric added a commit that referenced this issue Nov 8, 2017
- I've removed AndSimpleName, since the only thing with a simple name so far is JavaClass, and I can't think of any other future case
- I've named everything consistently 'simple name', not 'simple class name', since the existing predicate refers just to 'simple name', and within the syntax, it should be clear that it refers to classes

PR: #40
Issue: #41
@stefluhh stefluhh mentioned this issue Nov 12, 2017
@codecholeric codecholeric self-assigned this Nov 12, 2017
codecholeric added a commit that referenced this issue Nov 15, 2017
Adds the missing fluent API to finish #41 

Resolves #41
codecholeric added a commit that referenced this issue Nov 18, 2017
… for that()...simpleName...() and added NamingConventionIntegrationTest to assert the behavior of those examples for the future.

Issue: #41
@codecholeric codecholeric added this to the 0.8.0 milestone May 16, 2018
codecholeric added a commit that referenced this issue Feb 21, 2021
Implement haveNameEndingWith / haveNameNotEndingWith
Issue: #41
codecholeric added a commit that referenced this issue Feb 21, 2021
- I've removed AndSimpleName, since the only thing with a simple name so far is JavaClass, and I can't think of any other future case
- I've named everything consistently 'simple name', not 'simple class name', since the existing predicate refers just to 'simple name', and within the syntax, it should be clear that it refers to classes

PR: #40
Issue: #41
codecholeric pushed a commit that referenced this issue Feb 21, 2021
- Implemented ClassesThat for haveSimpleNameStartingWith/EndingWith/Containing and negations
- Implemented ClassesShould for haveSimpleNameContaining and negation
codecholeric pushed a commit that referenced this issue Feb 21, 2021
- Added an example IntegrationTest
- Polished Javadoc

Issue #41
codecholeric added a commit that referenced this issue Feb 21, 2021
Adds the missing fluent API to finish #41 

Resolves #41
codecholeric added a commit that referenced this issue Feb 21, 2021
… for that()...simpleName...() and added NamingConventionIntegrationTest to assert the behavior of those examples for the future.

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

Successfully merging a pull request may close this issue.

1 participant