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

Allow static import of AssertJ BDDAssertions #403

Closed
wants to merge 2 commits into from

Conversation

vpavic
Copy link
Contributor

@vpavic vpavic commented Jan 15, 2024

Analogous to the allowed import BDDMockito, Spring JavaFormat should also allow static import of AssertJ's BDDAssertions.

Note that there's an additional commit in this PR that removes a duplicate exclude that has sneaked in.

@wilkinsona
Copy link
Contributor

wilkinsona commented Jan 16, 2024

Analogous to the allowed import BDDMockito

This isn't quite the same as we're opinionated about the use of BDDMockito:

https://github.com/spring-io/spring-javaformat/blame/7db7c9765fbad3e1c0b8f021dc16533f9d5c10f2/spring-javaformat/spring-javaformat-checkstyle/src/main/resources/io/spring/javaformat/checkstyle/spring-checkstyle.xml#L122-L128

Arguably, we're also opinionated (although less so) about AssertJ as we're currently steering people towards assertThat. I'm not sure about making it easier for people to mix the two AssertJ styles or about moving to BDD-style AssertJ across the board. I'll see what the team thinks.

@philwebb
Copy link
Contributor

While I'm not so keen to use this ourselves (due to the potential clash with Mockito), I don't think it's a bad thing to allow the import for those that want to use it. Folks can always add a rule to ban the import in their own code (much like we do with assertThatThrownBy in Spring Boot.

@wilkinsona wilkinsona added this to the 0.0.x milestone Jan 16, 2024
@wilkinsona wilkinsona modified the milestones: 0.0.x, 0.0.42 Mar 28, 2024
@wilkinsona wilkinsona self-assigned this Mar 28, 2024
wilkinsona pushed a commit that referenced this pull request Mar 28, 2024
@vpavic vpavic deleted the update-static-imports branch March 28, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants