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

Remove usage of @InjectMocks #18557

Closed

Conversation

dreis2211
Copy link
Contributor

Hi,

this PR removes the usage of @InjectMocks inside tests. For some people - including me - it's similar to field injection and thus not desirable to have.

Cheers,
Christoph

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 10, 2019
@philwebb philwebb added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 10, 2019
@philwebb philwebb added this to the 2.2.x milestone Oct 10, 2019
@philwebb
Copy link
Member

I think we might even consider adding a checkstyle restriction for this.

@wilkinsona
Copy link
Member

I'd quite happily get rid of @Mock too so that setUp() isn't needed at all and the two fields can be final:

private final IntegrationGraphServer server = mock(IntegrationGraphServer.class);

private final IntegrationGraphEndpoint endpoint = new IntegrationGraphEndpoint(this.server);

@dreis2211
Copy link
Contributor Author

Let me incorporate your comments. Hope SpringOne Platform was/is a blast.

@snicoll snicoll self-assigned this Oct 12, 2019
snicoll pushed a commit that referenced this pull request Oct 12, 2019
snicoll pushed a commit that referenced this pull request Oct 12, 2019
@snicoll snicoll closed this in 53b0569 Oct 12, 2019
@snicoll snicoll modified the milestones: 2.2.x, 2.2.0 Oct 12, 2019
@snicoll
Copy link
Member

snicoll commented Oct 12, 2019

Well done and thank you again @dreis2211. The conference went well!

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

Successfully merging this pull request may close these issues.

None yet

5 participants