Code inspections do not seem to recognize Spring @Autowired and Mockito @Mock fields

I have a spring boot project that I am developing in Intellij 2017 and building with TC 10.0.5.

I would like to run all of the intellij inspections to ensure that we have no additional issues during the build process.  So far, I have two issues:

 

  1. It appears the the inspections running in TC do not have the context to know that it is a spring boot app or mockito test.
  2. The inspection process seems to take 2-2.5m to run.

Here are some examples of an errors:

27: imageProcessor Declaration can have final modifier

@Mock
private ImageProcessor imageProcessor;

13: foregroundQueueCapacity Declaration can have final modifier

@Value("${resize-queue.foreground.capacity}")
private int foregroundQueueCapacity;

Both of these are issues that would render this ineffective.  I'm guessing that I just don't have things configured quite right.  I've tried using both a gradle and intellij project as the root for this.

My .idea directory has the following files checked in:

  • modules
  • >> image-proxy.iml
  • >> image-proxy_main.iml
  • >> image-proxy_test.iml
  • codeStyleSettings.xml
  • compiler.cml
  • encoding.xml
  • gradle.xml
  • misc.xml
  • modules.xml
  • saveactions_settings.xml
  • vcs.xml

 

Regarding the second speed issue, is this the performance that others are seeing? 

 

0
2 comments

Does anyone have any thoughts on this?  

It's been quite frustrating to not have this work as I would have thought it would.

0

I did notice this warning:

> AWSConfig.java (1)
25: AWSConfig Application context not configured for this file

 

This would suggest that the facet that IntelliJ finds when loading, isn't loading correctly when TeamCity is loading it.

0

Please sign in to leave a comment.