Light project descriptor should implement 'equals()' and 'hashCode()'
Reports test project descriptors and descriptor builders (subclasses of com.intellij.testFramework.LightProjectDescriptor) that do not override both equals() and hashCode().
A light test reuses the already opened project only when the previously used descriptor equals() the one requested by the current test (see com.intellij.testFramework.LightPlatformTestCase#doSetup). With the default identity equals(), every freshly created descriptor instance is considered different, which forces a full project re-setup and slows the tests down.
Either implement equals() and hashCode(), or reuse a single shared descriptor instance (for example, a static final field or a Kotlin object).
Classes that publish their own shared descriptor instance in a static field are not reported. Descriptors that are only referenced through a static final field of the test class cannot be recognized as reused and may still be reported; the inspection is therefore disabled by default.
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
LightProjectDescriptorEqualsHashCode- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Inspection ID: LightProjectDescriptorEqualsHashCode
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |